summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2016-06-07 21:10:04 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2016-06-07 21:42:17 -0400
commit55297c7df662c8316312110104ee806742226db2 (patch)
tree0cf90b3432929edaf224ca49d767d664653aaef0
parentc511e0c223817de89a85b5614c8c58c83ede2d00 (diff)
downloadgstreamer-plugins-bad-55297c7df662c8316312110104ee806742226db2.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
-rw-r--r--ext/webp/gstwebpdec.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/ext/webp/gstwebpdec.c b/ext/webp/gstwebpdec.c
index 6877cd457..f582cc8bd 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);
@@ -124,6 +126,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");
}
@@ -214,8 +217,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);
}
@@ -244,11 +245,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;
}
@@ -278,6 +274,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)