From faf903720a6ab6d99b2567cd6af8195b07ff5fab Mon Sep 17 00:00:00 2001 From: Ilya Konstantinov Date: Mon, 11 May 2015 16:44:33 +0200 Subject: [PATCH] vtenc: no need for queue_length with try_pop --- sys/applemedia/vtenc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/applemedia/vtenc.c b/sys/applemedia/vtenc.c index bcfc6e0..100db54 100644 --- a/sys/applemedia/vtenc.c +++ b/sys/applemedia/vtenc.c @@ -740,6 +740,7 @@ static GstFlowReturn gst_vtenc_finish (GstVideoEncoder * enc) { GstVTEnc *self = GST_VTENC_CAST (enc); + GstVideoCodecFrame *outframe; GstFlowReturn ret = GST_FLOW_OK; OSStatus vt_status; @@ -757,9 +758,7 @@ gst_vtenc_finish (GstVideoEncoder * enc) (int) vt_status); } - while (g_async_queue_length (self->cur_outframes) > 0) { - GstVideoCodecFrame *outframe = g_async_queue_try_pop (self->cur_outframes); - + while ((outframe = g_async_queue_try_pop (self->cur_outframes))) { ret = gst_video_encoder_finish_frame (GST_VIDEO_ENCODER_CAST (self), outframe); @@ -1049,6 +1048,7 @@ gst_vtenc_encode_frame (GstVTEnc * self, GstVideoCodecFrame * frame) CMTime ts, duration; GstCoreMediaMeta *meta; CVPixelBufferRef pbuf = NULL; + GstVideoCodecFrame *outframe; OSStatus vt_status; GstFlowReturn ret = GST_FLOW_OK; guint i; @@ -1205,9 +1205,7 @@ gst_vtenc_encode_frame (GstVTEnc * self, GstVideoCodecFrame * frame) CVPixelBufferRelease (pbuf); i = 0; - while (g_async_queue_length (self->cur_outframes) > 0) { - GstVideoCodecFrame *outframe = g_async_queue_try_pop (self->cur_outframes); - + while ((outframe = g_async_queue_try_pop (self->cur_outframes))) { /* Try to renegotiate once */ if (i == 0) { meta = gst_buffer_get_core_media_meta (outframe->output_buffer); -- 2.7.4