wang-bin / QtAV

A cross-platform multimedia framework based on Qt and FFmpeg. 基于Qt和FFmpeg的跨平台高性能音视频播放框架. Recommand to use new sdk https://github.com/wang-bin/mdk-sdk
http://qtav.org
3.93k stars 1.5k forks source link

some MJPG Streams causes player crashes after a while on Windows #358

Open AlexLonardi opened 9 years ago

AlexLonardi commented 9 years ago

I've noticed that keeping opened some MJPEG streams causes a crash after a while, only in Windows environment (tested both in XP x32 and Win7 x64, every usage under Linux environment instead went fine) and the commits:

I can reproduce this behavior in the player example, tested with both Qt 5.2.1 and 5.3.2.

To reproduce this issue, simply load player (or QMLPlayer, or any) example with an MJPEG stream URL as parameter. After a while (usually <5 minutes) that the stream is playing, the player starts to allocate a lot of memory, until it crashes with a segmentation fault. On console I get a lot of: Warning: "[AVDemuxer] error: Immediate exit requested"

As far as I can see from stacktrace and messages, it's indicative of an error external to the player or QtAV itself, but maybe it can be avoided with a different configuration of the underlying services used. As I mentioned, not all streams reproduces this behavior. I can't get a rule to profile a good stream from a bad, but I think that's something related to the reply latency (and timeout). I got errors with this one: http://webcam.hotelbibionepalace.it/mjpg/video.mjpg (beware, it loads really slowly, over 2 minutes sometimes) and others under a private network, made from different IPCams.

Thanks in advance for any tips about.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/7782668-some-mjpg-streams-causes-player-crashes-after-a-while-on-windows?utm_campaign=plugin&utm_content=tracker%2F307703&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F307703&utm_medium=issues&utm_source=github).
wang-bin commented 9 years ago

Is there a tool to create such a mjpeg stream for testing? I can't test the your url becasue network is slow. btw, you can send full log. remember to set environment var QTAV_LOG=all.

AlexLonardi commented 9 years ago

Hi Wang, of course you can make your own mjpeg stream with a lot of tool, even with VLC. For instance, you can follow this tutorial: http://www.howtogeek.com/120202/how-to-record-your-desktop-to-a-file-or-stream-it-over-the-internet-with-vlc/ Under the section of "Live-Streaming Your Desktop". Remember to setup a profile which uses MJPEG codec.

Unfortunatly, local streams are always played nicely. I think that you've to introduce some network issues between you and the stream source. For instance, my sources are taken from a VPN with a 3000ms latency, with some packet losses. To simulate this behavior locally you need some network shaping tool, or a proper local network infrastructure. Can't you at all play the above stream URL? I usually leave it about 2 minutes, pressing "Ok" to timeout popups and leaving stream loading (which continues undisturbed over timeout).

AlexLonardi commented 9 years ago

I've found some other mjpeg stream URLs for testing: http://rax1.bsn.net/mjpg/video.mjpg?streamprofile=Balanced http://wmccpinetop.axiscam.net/mjpg/video.mjpg http://212.162.177.75/mjpg/video.mjpg http://plazacam.studentaffairs.duke.edu/mjpg/video.mjpg http://trackfield.webcam.oregonstate.edu/mjpg/video.mjpg http://50.73.56.89/mjpg/video.mjpg http://construction.sfhs.com/mjpg/video.mjpg http://208.42.203.54:8588/mjpg/video.mjpg

wang-bin commented 9 years ago

how to play the stream that vlc created?

AlexLonardi commented 9 years ago

Simply set as argument to your player the source stream url, that will be something like:

://:/ eg: http://localhost:8080/mystream You should see VLC in playing state when streaming is performed (like normal reproduction but without video output if you have not specified video out as destination). You can even use VLC to connect to your stream via "Open network stream" option under Media (or File, depends by version) menu.