tests: simple-decoder: flush decoded frames at EOS.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Fri, 18 Jan 2013 09:35:44 +0000 (10:35 +0100)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Fri, 18 Jan 2013 09:35:44 +0000 (10:35 +0100)
Flush the remaining decoded frames when an end-of-stream is reached.

tests/simple-decoder.c

index 373fd8e3c35068d699132efcadbb28b95bd475e7..e6c47387ade708b81855eb75f462a80348f7eb4b 100644 (file)
@@ -233,7 +233,7 @@ decoder_thread(gpointer data)
     RenderFrame *rfp;
     GstBuffer *buffer;
     GstClockTime pts;
-    gboolean got_surface;
+    gboolean got_surface, got_eos = FALSE;
     gint64 end_time;
     guint ofs;
 
@@ -282,7 +282,11 @@ decoder_thread(gpointer data)
             /* nothing to do, just continue to the next iteration */
             break;
         case GST_VAAPI_DECODER_STATUS_END_OF_STREAM:
-            goto send_eos;
+            gst_vaapi_decoder_flush(app->decoder);
+            if (got_eos)
+                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);