Core-2-Extreme / Video_player_for_3DS

Video player for 3ds
https://gbatemp.net/threads/release-video-player-for-3ds.586094
GNU General Public License v3.0
181 stars 17 forks source link

Failure when decoding a video containing B-frame. #11

Closed windows-server-2003 closed 3 years ago

windows-server-2003 commented 3 years ago

Current implementation repeats reading a single frame and trying to decode it alone, but decoding a B-frame requires some frames after it. As a result, avcodec_receive_frame() returns AVERROR(EAGAIN) (refer to https://ffmpeg.org/doxygen/3.4/group__lavc__decoding.html#ga11e6542c4e66d3028668788a1a74217c). The actual behavior of the app is a complete freeze. This might be another issue because I think it is better to show an error message and stop playing. If you download a random youtube video with youtube-dl -f 160 [link], it probably contains B-frames, so you can test with it.

I will work on this issue and open a PR if that's not a problem for you.

Core-2-Extreme commented 3 years ago

I found that the actual freeze cause was Util_convert_seconds_to_time() function not ffmpeg. The ffmpeg does fail at first, but it's only first few frames after that everything will be decoded correctly.

anyway, I fixed Util_convert_seconds_to_time() so the app won't freeze anymore.

windows-server-2003 commented 3 years ago

Thanks