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.94k stars 1.5k forks source link

Endless loop when stopping and destroying AVPlayer #874

Open obeezzy opened 7 years ago

obeezzy commented 7 years ago

Sometimes when I try closing my program during video playback (note that I call AVPlayer::stop() in the destructor), I run into this endless loop with the log saying:

"stopping demuxer thread..." "all avthread finished. try to exit demux thread<<<<<<" "stopping demuxer thread..." "all avthread finished. try to exit demux thread<<<<<<"

However, if I remove the stop in the destructor of my object, I get this:

"stopping thread QtAV::VideoThread(0x1352b98)" "stopping thread QtAV::VideoThread(0x1352b98)" "stopping thread QtAV::VideoThread(0x1352b98)"

What is the proper way to destroy the AVPlayer object? Am I doing something wrong?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/44964915-endless-loop-when-stopping-and-destroying-avplayer?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).
silajim commented 6 years ago

I am having the same issue, but it happens every time, seems to be deadlocked in the run function.