int width, int height);
static void gst_vp8_dec_handle_resolution_change (GstVPXDec * dec,
vpx_image_t * img, GstVideoFormat fmt);
+static gboolean gst_vp8_dec_get_needs_sync_point (GstVPXDec * dec);
static GstStaticPadTemplate gst_vp8_dec_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_DEBUG_FUNCPTR (gst_vp8_dec_set_default_format);
vpx_class->handle_resolution_change =
GST_DEBUG_FUNCPTR (gst_vp8_dec_handle_resolution_change);
+ vpx_class->get_needs_sync_point =
+ GST_DEBUG_FUNCPTR (gst_vp8_dec_get_needs_sync_point);
GST_DEBUG_CATEGORY_INIT (gst_vp8dec_debug, "vp8dec", 0, "VP8 Decoder");
}
}
}
+static gboolean
+gst_vp8_dec_get_needs_sync_point (GstVPXDec * dec)
+{
+ return FALSE;
+}
+
#endif /* HAVE_VP8_DECODER */
vpx_image_t * img, GstVideoFormat * fmt);
static void gst_vp9_dec_handle_resolution_change (GstVPXDec * dec,
vpx_image_t * img, GstVideoFormat fmt);
+static gboolean gst_vp9_dec_get_needs_sync_point (GstVPXDec * dec);
static GstStaticPadTemplate gst_vp9_dec_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_DEBUG_FUNCPTR (gst_vp9_dec_get_valid_format);
vpx_class->handle_resolution_change =
GST_DEBUG_FUNCPTR (gst_vp9_dec_handle_resolution_change);
+ vpx_class->get_needs_sync_point =
+ GST_DEBUG_FUNCPTR (gst_vp9_dec_get_needs_sync_point);
GST_DEBUG_CATEGORY_INIT (gst_vp9dec_debug, "vp9dec", 0, "VP9 Decoder");
}
}
}
+static gboolean
+gst_vp9_dec_get_needs_sync_point (GstVPXDec * dec)
+{
+ return TRUE;
+}
+
#endif /* HAVE_VP9_DECODER */
gst_vpx_dec_init (GstVPXDec * gst_vpx_dec)
{
GstVideoDecoder *decoder = (GstVideoDecoder *) gst_vpx_dec;
+ GstVPXDecClass *vpxclass = GST_VPX_DEC_GET_CLASS (gst_vpx_dec);
GST_DEBUG_OBJECT (gst_vpx_dec, "gst_vpx_dec_init");
gst_video_decoder_set_packetized (decoder, TRUE);
gst_vpx_dec->deblocking_level = DEFAULT_DEBLOCKING_LEVEL;
gst_vpx_dec->noise_level = DEFAULT_NOISE_LEVEL;
+ if (vpxclass->get_needs_sync_point) {
+ gst_video_decoder_set_needs_sync_point (GST_VIDEO_DECODER (gst_vpx_dec),
+ vpxclass->get_needs_sync_point (gst_vpx_dec));
+ }
+
gst_video_decoder_set_needs_format (decoder, TRUE);
gst_video_decoder_set_use_default_pad_acceptcaps (decoder, TRUE);
GST_PAD_SET_ACCEPT_TEMPLATE (GST_VIDEO_DECODER_SINK_PAD (decoder));
gst_buffer_unmap (frame->input_buffer, &minfo);
if (status != VPX_CODEC_OK) {
- GST_WARNING_OBJECT (dec, "VPX preprocessing error: %s",
+ GST_INFO_OBJECT (dec, "VPX preprocessing error: %s",
gst_vpx_error_name (status));
return GST_FLOW_CUSTOM_SUCCESS_1;
}
if (!stream_info.is_kf) {
- GST_WARNING_OBJECT (dec, "No keyframe, skipping");
+ GST_INFO_OBJECT (dec, "No keyframe, skipping");
return GST_FLOW_CUSTOM_SUCCESS_1;
}
if (stream_info.w == 0 || stream_info.h == 0) {
if (!dec->decoder_inited) {
ret = vpxclass->open_codec (dec, frame);
if (ret == GST_FLOW_CUSTOM_SUCCESS_1) {
+ GstVideoDecoderRequestSyncPointFlags flags = 0;
+
+ if (gst_video_decoder_get_needs_sync_point (decoder))
+ flags |= GST_VIDEO_DECODER_REQUEST_SYNC_POINT_DISCARD_INPUT;
+
+ gst_video_decoder_request_sync_point (decoder, frame, flags);
gst_video_decoder_drop_frame (decoder, frame);
return GST_FLOW_OK;
} else if (ret != GST_FLOW_OK) {
gst_buffer_unmap (frame->input_buffer, &minfo);
if (status) {
+ GstVideoDecoderRequestSyncPointFlags flags = 0;
+
GST_VIDEO_DECODER_ERROR (decoder, 1, LIBRARY, ENCODE,
("Failed to decode frame"), ("%s", gst_vpx_error_name (status)), ret);
+
+ if (gst_video_decoder_get_needs_sync_point (decoder))
+ flags |= GST_VIDEO_DECODER_REQUEST_SYNC_POINT_DISCARD_INPUT;
+
+ gst_video_decoder_request_sync_point (decoder, frame, flags);
gst_video_codec_frame_unref (frame);
return ret;
}