diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2016-06-07 21:10:04 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2016-06-07 21:10:04 -0400 |
commit | d33352edb506b4dd6f193de07c3853914c0de8d6 (patch) | |
tree | fc42449d32c611c14d34ae088d6b6b0bf8bcd231 /ext/webp | |
parent | 50537e2c08cec2c7b21f1a14299899fbef892368 (diff) | |
download | gstreamer-plugins-bad-d33352edb506b4dd6f193de07c3853914c0de8d6.tar.gz |
webpdec: Wait for segment event before checking it
The heuristic to choose between packetise or not was changed to use the
segment format. The problem is that this change is reading the segment
during the caps event handling. The segment event will only be sent
after. That prevented the decoder to go in packetize mode, and avoid
useless parsing.
https://bugzilla.gnome.org/show_bug.cgi?id=736252
Diffstat (limited to 'ext/webp')
-rw-r--r-- | ext/webp/gstwebpdec.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/ext/webp/gstwebpdec.c b/ext/webp/gstwebpdec.c index 68215dc9b..85bb5bf36 100644 --- a/ext/webp/gstwebpdec.c +++ b/ext/webp/gstwebpdec.c @@ -72,6 +72,8 @@ static GstFlowReturn gst_webp_dec_handle_frame (GstVideoDecoder * bdec, GstVideoCodecFrame * frame); static gboolean gst_webp_dec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query); +static gboolean gst_webp_dec_sink_event (GstVideoDecoder * bdec, + GstEvent * event); static gboolean gst_webp_dec_reset_frame (GstWebPDec * webpdec); @@ -123,6 +125,7 @@ gst_webp_dec_class_init (GstWebPDecClass * klass) vdec_class->set_format = gst_webp_dec_set_format; vdec_class->handle_frame = gst_webp_dec_handle_frame; vdec_class->decide_allocation = gst_webp_dec_decide_allocation; + vdec_class->sink_event = gst_webp_dec_sink_event; GST_DEBUG_CATEGORY_INIT (webp_dec_debug, "webpdec", 0, "WebP decoder"); } @@ -213,8 +216,6 @@ gst_webp_dec_start (GstVideoDecoder * decoder) { GstWebPDec *webpdec = (GstWebPDec *) decoder; - gst_video_decoder_set_packetized (GST_VIDEO_DECODER (webpdec), FALSE); - return gst_webp_dec_reset_frame (webpdec); } @@ -243,11 +244,6 @@ gst_webp_dec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state) gst_video_codec_state_unref (webpdec->input_state); webpdec->input_state = gst_video_codec_state_ref (state); - if (decoder->input_segment.format == GST_FORMAT_TIME) - gst_video_decoder_set_packetized (decoder, TRUE); - else - gst_video_decoder_set_packetized (decoder, FALSE); - return TRUE; } @@ -277,6 +273,25 @@ gst_webp_dec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query) return TRUE; } +static gboolean +gst_webp_dec_sink_event (GstVideoDecoder * bdec, GstEvent * event) +{ + const GstSegment *segment; + + if (GST_EVENT_TYPE (event) != GST_EVENT_SEGMENT) + goto done; + + gst_event_parse_segment (event, &segment); + + if (segment->format == GST_FORMAT_TIME) + gst_video_decoder_set_packetized (bdec, TRUE); + else + gst_video_decoder_set_packetized (bdec, FALSE); + +done: + return GST_VIDEO_DECODER_CLASS (parent_class)->sink_event (bdec, event); +} + static GstFlowReturn gst_webp_dec_parse (GstVideoDecoder * decoder, GstVideoCodecFrame * frame, GstAdapter * adapter, gboolean at_eos) |