GNOME Bugzilla – Bug 734608
avvidec: decoded frames lost on EOS
Last modified: 2014-08-12 07:53:07 UTC
When the videodecoder receives an EOS and has already pushed all the frames, it will call the decoder drain() function and then send EOS downstream. avviddec has a try loop to get remaining frames. The loop stops when len=0 and have_data=0; if (len < 0 || have_data == 0) break; This causes loss of buffers.
Created attachment 283088 [details] [review] reall keep trying to decode frames This is a simple fix. Not sure if correct but solves the issues and really keeps trying unless there's an error.
You can see the problem with any video, using a gst-launch with fakesink. In 0.10 all frames are shown in the fakesink messages, but not in 1.x.
That would mean that libav returns no data for some calls in between but later does without getting more input. That seems weird. Which codec is this? Do you have a sample stream you can share?
Created attachment 283091 [details] test video Video sample.
(In reply to comment #3) > That would mean that libav returns no data for some calls in between but later > does without getting more input. That seems weird. > > Which codec is this? Do you have a sample stream you can share? Yes, it is weird. On the attached file, just run: gst-launch-0.10 filesrc location=video-second.mov ! decodebin ! fakesink silent=false -v and: gst-launch-1.0 filesrc location=video-second.mov ! decodebin ! fakesink silent=false -v Hopefully, you'll see that 1.0 doesn't show the last frames.
(In reply to comment #3) > That would mean that libav returns no data for some calls in between but later > does without getting more input. That seems weird. > After some debugging, I think libav is returning have_data correctly. I'm now looking into gstavviddec. there might be something wrong there.
Created attachment 283110 [details] [review] frame loss on EOS From the commit log: have_data is not propagated from gst_ffmpegviddec_video_frame to gst_ffmpegviddec_frame. have_data is only set to 1 in gst_ffmpegviddec_frame if a frame pointer is passed. However, this is not true while draining, which means that have_data from libav will be ignored.
commit 1307b31e1cf9548ad3c9896fc0e9afe3d0516e40 Author: Aleix Conchillo Flaqué <aleix@oblong.com> Date: Mon Aug 11 14:16:55 2014 +0200 avviddec: Don't lose frames on EOS have_data is not propagated from gst_ffmpegviddec_video_frame to gst_ffmpegviddec_frame. have_data is only set to 1 in gst_ffmpegviddec_frame if a frame pointer is passed. However, this is not true while draining, which means that have_data from libav will be ignored. https://bugzilla.gnome.org/show_bug.cgi?id=734608