diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.c b/gst-libs/gst/vaapi/gstvaapidecoder.c index bec06f5700..0b60b87755 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder.c @@ -305,10 +305,6 @@ decode_step (GstVaapiDecoder * decoder) gboolean got_frame; guint got_unit_size, input_size; - status = gst_vaapi_decoder_check_status (decoder); - if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) - return status; - /* Fill adapter with all buffers we have in the queue */ for (;;) { buffer = pop_buffer (decoder); @@ -1002,15 +998,6 @@ gst_vaapi_decoder_push_frame (GstVaapiDecoder * decoder, push_frame (decoder, frame); } -GstVaapiDecoderStatus -gst_vaapi_decoder_check_status (GstVaapiDecoder * decoder) -{ - if (decoder->context && - gst_vaapi_context_get_surface_count (decoder->context) < 1) - return GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE; - return GST_VAAPI_DECODER_STATUS_SUCCESS; -} - GstVaapiDecoderStatus gst_vaapi_decoder_parse (GstVaapiDecoder * decoder, GstVideoCodecFrame * base_frame, GstAdapter * adapter, gboolean at_eos, @@ -1034,8 +1021,6 @@ gst_vaapi_decoder_parse (GstVaapiDecoder * decoder, GstVaapiDecoderStatus gst_vaapi_decoder_decode (GstVaapiDecoder * decoder, GstVideoCodecFrame * frame) { - GstVaapiDecoderStatus status; - g_return_val_if_fail (decoder != NULL, GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER); g_return_val_if_fail (frame != NULL, @@ -1043,9 +1028,6 @@ gst_vaapi_decoder_decode (GstVaapiDecoder * decoder, GstVideoCodecFrame * frame) g_return_val_if_fail (frame->user_data != NULL, GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER); - status = gst_vaapi_decoder_check_status (decoder); - if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) - return status; return do_decode (decoder, frame); } diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.h b/gst-libs/gst/vaapi/gstvaapidecoder.h index 2c5e967ed4..b9bca4b2c0 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder.h @@ -136,9 +136,6 @@ gst_vaapi_decoder_flush (GstVaapiDecoder * decoder); GstVaapiDecoderStatus gst_vaapi_decoder_reset (GstVaapiDecoder * decoder); -GstVaapiDecoderStatus -gst_vaapi_decoder_check_status (GstVaapiDecoder * decoder); - gboolean gst_vaapi_decoder_update_caps (GstVaapiDecoder * decoder, GstCaps * caps); diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 4441392502..50407d83af 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -375,15 +375,6 @@ gst_vaapidecode_update_src_caps (GstVaapiDecode * decode) return TRUE; } -static void -gst_vaapidecode_release (GstVaapiDecode * decode) -{ - g_mutex_lock (&decode->surface_ready_mutex); - g_cond_signal (&decode->surface_ready); - g_mutex_unlock (&decode->surface_ready_mutex); - gst_object_unref (decode); -} - /* check whether the decoded surface size has changed */ static gboolean is_surface_resolution_changed (GstVaapiDecode * decode, @@ -541,9 +532,6 @@ gst_vaapidecode_push_decoded_frame (GstVideoDecoder * vdec, return GST_FLOW_ERROR; } - gst_vaapi_surface_proxy_set_destroy_notify (proxy, - (GDestroyNotify) gst_vaapidecode_release, gst_object_ref (decode)); - if (is_src_allocator_dmabuf (decode)) { vaapi_params.proxy = gst_vaapi_surface_proxy_ref (proxy); params = (GstBufferPoolAcquireParams *) & vaapi_params; @@ -706,18 +694,6 @@ gst_vaapidecode_handle_frame (GstVideoDecoder * vdec, /* Decode current frame */ for (;;) { status = gst_vaapi_decoder_decode (decode->decoder, frame); - if (status == GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE) { - /* Make sure that there are no decoded frames waiting in the - output queue. */ - gst_vaapidecode_push_all_decoded_frames (decode); - - g_mutex_lock (&decode->surface_ready_mutex); - if (gst_vaapi_decoder_check_status (decode->decoder) == - GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE) - g_cond_wait (&decode->surface_ready, &decode->surface_ready_mutex); - g_mutex_unlock (&decode->surface_ready_mutex); - continue; - } if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) goto error_decode; break; @@ -987,8 +963,6 @@ gst_vaapidecode_destroy (GstVaapiDecode * decode) gst_vaapidecode_purge (decode); gst_vaapi_decoder_replace (&decode->decoder, NULL); - - gst_vaapidecode_release (gst_object_ref (decode)); } static gboolean @@ -1016,11 +990,6 @@ gst_vaapidecode_reset (GstVaapiDecode * decode, GstCaps * caps, static void gst_vaapidecode_finalize (GObject * object) { - GstVaapiDecode *const decode = GST_VAAPIDECODE (object); - - g_cond_clear (&decode->surface_ready); - g_mutex_clear (&decode->surface_ready_mutex); - gst_vaapi_plugin_base_finalize (GST_VAAPI_PLUGIN_BASE (object)); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -1537,9 +1506,6 @@ gst_vaapidecode_init (GstVaapiDecode * decode) gst_vaapi_plugin_base_init (GST_VAAPI_PLUGIN_BASE (decode), GST_CAT_DEFAULT); - g_mutex_init (&decode->surface_ready_mutex); - g_cond_init (&decode->surface_ready); - gst_video_decoder_set_packetized (vdec, FALSE); } diff --git a/gst/vaapi/gstvaapidecode.h b/gst/vaapi/gstvaapidecode.h index b7c4160c53..77ab3ce709 100644 --- a/gst/vaapi/gstvaapidecode.h +++ b/gst/vaapi/gstvaapidecode.h @@ -43,8 +43,6 @@ struct _GstVaapiDecode { GstCaps *srcpad_caps; GstVideoInfo decoded_info; GstVaapiDecoder *decoder; - GMutex surface_ready_mutex; - GCond surface_ready; GstCaps *allowed_sinkpad_caps; GstCaps *allowed_srcpad_caps; guint current_frame_size; diff --git a/tests/internal/simple-decoder.c b/tests/internal/simple-decoder.c index f6b1499886..134b845145 100644 --- a/tests/internal/simple-decoder.c +++ b/tests/internal/simple-decoder.c @@ -86,7 +86,6 @@ typedef struct GstVaapiDecoder *decoder; GThread *decoder_thread; volatile gboolean decoder_thread_cancel; - GCond decoder_ready; GAsyncQueue *decoder_queue; GstVaapiCodec codec; guint fps_n; @@ -219,14 +218,6 @@ get_error_string (AppError error) return str; } -static void -decoder_release (App * app) -{ - g_mutex_lock (&app->mutex); - g_cond_signal (&app->decoder_ready); - g_mutex_unlock (&app->mutex); -} - static gpointer decoder_thread (gpointer data) { @@ -237,8 +228,7 @@ decoder_thread (gpointer data) RenderFrame *rfp; GstBuffer *buffer; GstClockTime pts; - gboolean got_surface, got_eos = FALSE; - gint64 end_time; + gboolean got_eos = FALSE; guint ofs; g_print ("Decoder thread started\n"); @@ -266,12 +256,9 @@ decoder_thread (gpointer data) SEND_ERROR ("failed to push buffer to decoder"); gst_buffer_replace (&buffer, NULL); - get_surface: status = gst_vaapi_decoder_get_surface (app->decoder, &proxy); switch (status) { case GST_VAAPI_DECODER_STATUS_SUCCESS: - gst_vaapi_surface_proxy_set_destroy_notify (proxy, - (GDestroyNotify) decoder_release, app); rfp = render_frame_new (); if (!rfp) SEND_ERROR ("failed to allocate render frame"); @@ -290,16 +277,6 @@ decoder_thread (gpointer data) goto send_eos; got_eos = TRUE; break; - case GST_VAAPI_DECODER_STATUS_ERROR_NO_SURFACE: - end_time = g_get_monotonic_time () + G_TIME_SPAN_SECOND; - g_mutex_lock (&app->mutex); - got_surface = g_cond_wait_until (&app->decoder_ready, &app->mutex, - end_time); - g_mutex_unlock (&app->mutex); - if (got_surface) - goto get_surface; - SEND_ERROR ("failed to acquire a surface within one second"); - break; default: SEND_ERROR ("%s", get_decoder_status_string (status)); break; @@ -550,7 +527,6 @@ app_free (App * app) g_async_queue_unref (app->decoder_queue); app->decoder_queue = NULL; } - g_cond_clear (&app->decoder_ready); if (app->timer) { g_timer_destroy (app->timer); @@ -574,7 +550,6 @@ app_new (void) g_mutex_init (&app->mutex); g_cond_init (&app->event_cond); - g_cond_init (&app->decoder_ready); g_cond_init (&app->render_ready); app_set_framerate (app, 60, 1);