Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash if start/stop continous #38

Closed
pubpy2015 opened this issue May 16, 2021 · 26 comments
Closed

Crash if start/stop continous #38

pubpy2015 opened this issue May 16, 2021 · 26 comments

Comments

@pubpy2015
Copy link

Hi,

I am test on WinForms Sample (Basic) by Add a button for player.Open(rtsp url) and a button on for player.Stop():
image
image

@pubpy2015
Copy link
Author

image

@pubpy2015
Copy link
Author

image

@SuRGeoNix
Copy link
Owner

SuRGeoNix commented May 16, 2021

player.Stop() requires re-opening. You use Stop as Pause? Do you get the error when you first time click Stop?

@pubpy2015
Copy link
Author

I am using player.Open(rtsp ur) on Play button and player.Stop() on Stop button:
image

@SuRGeoNix
Copy link
Owner

SuRGeoNix commented May 16, 2021

@pubpy2015 You and your rtsp mess :) You try to Stop before it actually opened. that's the issue...

I knew that some locks are required during open/stop/dispose etc... I guess I will add them

@SuRGeoNix
Copy link
Owner

SuRGeoNix commented May 16, 2021

I guess that was it, let me know if otherwise. I've not finished with locks yet, because I was planning to update Player.cs and Plugins but nice catch. I will need to come back on this one as Stop should ideally cancel previous Open for faster Stop.

@SuRGeoNix
Copy link
Owner

One more thing. It's your responsibility to Stop the Player before Open. So generally, consider doing player.Stop(); also on your button1

@pubpy2015
Copy link
Author

I am trying on new code version. Better but it will make app hang in short time.
Sometime still error here:
image

Can you set player/demuxer status to Stopping and break open thread ?

@SuRGeoNix
Copy link
Owner

Did you try to Stop before Open at button1?

@pubpy2015
Copy link
Author

No, if place Stop before Open, app will no crash but hang in more time.
If rtsp source is not available, you must wait more time before you can click Stop button.
Incase of app have multiple players, it is not convenient.
I am seeing you have DemuxInterrupt property and Stopping status. can you using this to break Open thread ?
image
image

@SuRGeoNix
Copy link
Owner

SuRGeoNix commented May 16, 2021

What exactly are you doing? Pressing Open/Stop buttons all the time? I mean is this a real scenario or you just try hard to crash it?

@pubpy2015
Copy link
Author

I am doing an application like that:
image

each camera have 2 video streams, mainstream with higher resolution and substream with lower resolution.
In multiview mode, Flyleaf control will connect to substream of each camera.
when user double click to open camera1, application will stop substream of all cameras and open camera 1 with mainstream. Double click again will stop mainstream of camera1 and open substream of all cameras. => It will require open /stop continous in short time.

@SuRGeoNix SuRGeoNix reopened this May 16, 2021
@SuRGeoNix
Copy link
Owner

OK I think I've fixed the whole pyramid there of Start/Stop with also fast abort of opening

@pubpy2015
Copy link
Author

Yes, better performance but sometime still error here:
ảnh

@SuRGeoNix SuRGeoNix reopened this May 17, 2021
@SuRGeoNix
Copy link
Owner

My first problem is that I cannot easily test this. The second problem is that I still believe that it's not the proper way of doing this. However, give it a try but consider finding a better way of implementing this?

@SuRGeoNix
Copy link
Owner

@pubpy2015 Do you still have issues with this one, I will re-code some parts on version 3.2 (unfortunately not time for that currently).

@pubpy2015
Copy link
Author

Yes,

if rtsp source is ready, the problem here:
ảnh

If rtsp source is not available, the problem here:
ảnh

(you can try with any fake rtsp url, ex: rtsp://123.14.15.16:8554/live/c1234)

@pubpy2015
Copy link
Author

other problem is FlyLeaf control not redraw when resize:
ảnh

@SuRGeoNix
Copy link
Owner

What do you mean 'if rtsp source is ready' ?
The resize issue is for the designer only right?

@pubpy2015
Copy link
Author

What do you mean 'if rtsp source is ready' ?
this mean rtsp source 'online' and can play by player.

The resize issue is for the designer only right?
Yes.

@pubpy2015
Copy link
Author

pubpy2015 commented Jun 21, 2021

other problem is FlyLeaf control not redraw when resize:
ảnh

Add below code in Flyleaf user control constructor will fix this problem:
// set double buffer
this.SetStyle(ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor, true);

@pubpy2015
Copy link
Author

Problems solved

Sleep 1 milisecond here:
image

Add SignalToStop() method in DecoderContext.cs
image

call Signal ToStop() before Stop():
image

Video test:

fixed.mp4

@SuRGeoNix
Copy link
Owner

Nice, sorry but didn't have time lately to help you out with this one. I will included it on the next update (I will review general start/stop and memory leaks)

SuRGeoNix added a commit that referenced this issue Jul 17, 2021
…lated issue #40)

- Fixes crashing issues during start/stop (related issue #38)
- FlyleafLib.Controls.WPF: Fixes memory leaks & restores alt-f4
@SuRGeoNix
Copy link
Owner

Give another try with the latest version (3.1.9) and let me know if you still catch any crash!

@pubpy2015
Copy link
Author

It works well in most cases.
Very rarely does this error:

image
image

@SuRGeoNix
Copy link
Owner

Nice should be also fixed

SuRGeoNix added a commit that referenced this issue Aug 25, 2021
SuRGeoNix added a commit that referenced this issue Aug 25, 2021
SuRGeoNix added a commit that referenced this issue Aug 25, 2021
SuRGeoNix added a commit that referenced this issue Aug 25, 2021
…lated issue #40)

- Fixes crashing issues during start/stop (related issue #38)
- FlyleafLib.Controls.WPF: Fixes memory leaks & restores alt-f4
SuRGeoNix added a commit that referenced this issue Aug 25, 2021
SuRGeoNix added a commit that referenced this issue Aug 25, 2021
SuRGeoNix added a commit that referenced this issue Aug 25, 2021
SuRGeoNix added a commit that referenced this issue Aug 25, 2021
…lated issue #40)

- Fixes crashing issues during start/stop (related issue #38)
- FlyleafLib.Controls.WPF: Fixes memory leaks & restores alt-f4
SuRGeoNix added a commit that referenced this issue Aug 25, 2021
Former-commit-id: 6488b3f
SuRGeoNix added a commit that referenced this issue Aug 25, 2021
Former-commit-id: 6a6aebc
SuRGeoNix added a commit that referenced this issue Aug 25, 2021
Former-commit-id: 0737642
SuRGeoNix added a commit that referenced this issue Aug 25, 2021
…lated issue #40)

- Fixes crashing issues during start/stop (related issue #38)
- FlyleafLib.Controls.WPF: Fixes memory leaks & restores alt-f4


Former-commit-id: 513e290
SuRGeoNix added a commit that referenced this issue Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants