After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 626815 - vp8dec: infinite loop if EOS event before started
vp8dec: infinite loop if EOS event before started
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Windows
: Normal blocker
: 0.10.20
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-08-13 12:41 UTC by Philip Jägenstedt
Modified: 2010-08-19 09:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
quickfix (816 bytes, patch)
2010-08-13 12:41 UTC, Philip Jägenstedt
none Details | Review
patch (1.28 KB, patch)
2010-08-17 08:59 UTC, Philip Jägenstedt
committed Details | Review

Description Philip Jägenstedt 2010-08-13 12:41:16 UTC
gstbasevideodecoder.c has this loop when handling GST_EVENT_EOS:

        do {
          flow_ret =
              base_video_decoder_class->parse_data (base_video_decoder, TRUE);
        } while (flow_ret == GST_FLOW_OK);

gstvp8dec.c implements parse_data as such:

static GstFlowReturn
gst_vp8_dec_parse_data (GstBaseVideoDecoder * decoder, gboolean at_eos)
{
  return GST_FLOW_OK;
}

The result is quite obvious. I don't know what the design of basevideodecoder is supposed to be or what parse_data should mean, but my quickfix is simply returning GST_FLOW_NOT_SUPPORTED in gst_vp8_dec_parse_data, as it is both true and has the desired side-effect of not hanging the decoder.

I don't understand why this bug doesn't rear its ugly head all the time, perhaps for some reason GST_EVENT_EOS isn't always sent?
Comment 1 Philip Jägenstedt 2010-08-13 12:41:49 UTC
Created attachment 167804 [details] [review]
quickfix
Comment 2 Tim-Philipp Müller 2010-08-13 12:45:24 UTC
Marking as blocker for the release.
Comment 3 Sebastian Dröge (slomo) 2010-08-13 16:14:56 UTC
How can parse_data be called at all in vp8dec? It's only called by the video decoder base class if packetized is FALSE. It is TRUE for vp8dec...
Comment 4 Philip Jägenstedt 2010-08-16 08:28:01 UTC
The only way we could reproduce this in Opera was by shutting down the page quickly after opening it, which indicates a race condition of some sort. packetized is set to TRUE in gst_vp8_dec_start, and I assume that there's no guarantee that this is called before GST_EVENT_EOS reaches gst_base_video_decoder_sink_event.

Note that our custom src sends an eos event when it needs to shut down, which is probably why you won't see this is normal use.
Comment 5 Sebastian Dröge (slomo) 2010-08-16 08:51:42 UTC
Then the better solution might be to set packetized to TRUE in gst_vp8_dec_init() already

And start should maybe be called earlier already, maybe while the pads are activated
Comment 6 Philip Jägenstedt 2010-08-16 14:17:16 UTC
Yes, setting it in gst_vp8_dec_init should fix the problem as well. Calling start earlier might be good for other reasons, but I think it would only make the window smaller, not eliminate the problem.
Comment 7 Sebastian Dröge (slomo) 2010-08-17 08:20:27 UTC
Ok, do you want to provide a patch for that? :)
Comment 8 Philip Jägenstedt 2010-08-17 08:59:06 UTC
Created attachment 168038 [details] [review]
patch

Since you ask so nicely :)
Comment 9 Tim-Philipp Müller 2010-08-17 14:43:26 UTC
Comment on attachment 168038 [details] [review]
patch

Looks good, someone please push this, but with a better commit message if possible (no need to describe what the code is doing, but under what conditions this happened before and why, so that it's clear what this fixes without the need to refer to the bug which btw should also be mentioned in the msg). thanks!
Comment 10 Sebastian Dröge (slomo) 2010-08-19 09:18:57 UTC
commit e72574124f7470d8abd1fd221aab620593cad8b5
Author: Philip Jägenstedt <philipj@opera.com>
Date:   Fri Aug 13 14:34:21 2010 +0200

    vp8dec: Set GstBaseVideoDecoder::packetized to TRUE as soon as possible
    
    This fixes an infinite loop if an EOS event is received before
    GstBaseVideoDecoder::start() is called, e.g. immediately when the
    pads are activated.
    
    Fixes bug #626815.