diff options
-rw-r--r-- | sys/androidmedia/gstamcaudiodec.c | 18 | ||||
-rw-r--r-- | sys/androidmedia/gstamcvideodec.c | 21 | ||||
-rw-r--r-- | sys/androidmedia/gstamcvideoenc.c | 23 |
3 files changed, 42 insertions, 20 deletions
diff --git a/sys/androidmedia/gstamcaudiodec.c b/sys/androidmedia/gstamcaudiodec.c index 60cbc30e3..5174ea9d2 100644 --- a/sys/androidmedia/gstamcaudiodec.c +++ b/sys/androidmedia/gstamcaudiodec.c @@ -684,8 +684,9 @@ invalid_buffer_size: GST_ELEMENT_ERROR (self, LIBRARY, FAILED, (NULL), ("Invalid buffer size %u (bfp %d)", buffer_info.size, self->info.bpf)); gst_amc_codec_release_output_buffer (self->codec, idx, &err); - if (err) + if (err && !self->flushing) GST_ELEMENT_WARNING_FROM_ERROR (self, err); + g_clear_error (&err); gst_pad_push_event (GST_AUDIO_DECODER_SRC_PAD (self), gst_event_new_eos ()); gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self)); self->downstream_flow_ret = GST_FLOW_ERROR; @@ -698,8 +699,9 @@ failed_allocate: GST_ELEMENT_ERROR (self, LIBRARY, SETTINGS, (NULL), ("Failed to allocate output buffer")); gst_amc_codec_release_output_buffer (self->codec, idx, &err); - if (err) + if (err && !self->flushing) GST_ELEMENT_WARNING_FROM_ERROR (self, err); + g_clear_error (&err); gst_pad_push_event (GST_AUDIO_DECODER_SRC_PAD (self), gst_event_new_eos ()); gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self)); self->downstream_flow_ret = GST_FLOW_ERROR; @@ -1092,8 +1094,9 @@ gst_amc_audio_dec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf) if (self->downstream_flow_ret != GST_FLOW_OK) { memset (&buffer_info, 0, sizeof (buffer_info)); gst_amc_codec_queue_input_buffer (self->codec, idx, &buffer_info, &err); - if (err) + if (err && !self->flushing) GST_ELEMENT_WARNING_FROM_ERROR (self, err); + g_clear_error (&err); goto downstream_error; } @@ -1246,8 +1249,13 @@ gst_amc_audio_dec_drain (GstAmcAudioDec * self) ret = GST_FLOW_OK; } else { GST_ERROR_OBJECT (self, "Failed to queue input buffer"); - GST_ELEMENT_WARNING_FROM_ERROR (self, err); - ret = GST_FLOW_ERROR; + if (self->flushing) { + g_clear_error (&err); + ret = GST_FLOW_FLUSHING; + } else { + GST_ELEMENT_WARNING_FROM_ERROR (self, err); + ret = GST_FLOW_ERROR; + } } g_mutex_unlock (&self->drain_lock); diff --git a/sys/androidmedia/gstamcvideodec.c b/sys/androidmedia/gstamcvideodec.c index d47bad6b7..dc9a5cd08 100644 --- a/sys/androidmedia/gstamcvideodec.c +++ b/sys/androidmedia/gstamcvideodec.c @@ -707,8 +707,9 @@ retry: if (!gst_amc_codec_release_output_buffer (self->codec, idx, &err)) GST_ERROR_OBJECT (self, "Failed to release output buffer index %d", idx); - if (err) + if (err && !self->flushing) GST_ELEMENT_WARNING_FROM_ERROR (self, err); + g_clear_error (&err); goto invalid_buffer; } @@ -723,8 +724,9 @@ retry: if (!gst_amc_codec_release_output_buffer (self->codec, idx, &err)) GST_ERROR_OBJECT (self, "Failed to release output buffer index %d", idx); - if (err) + if (err && !self->flushing) GST_ELEMENT_WARNING_FROM_ERROR (self, err); + g_clear_error (&err); goto flow_error; } @@ -735,8 +737,9 @@ retry: if (!gst_amc_codec_release_output_buffer (self->codec, idx, &err)) GST_ERROR_OBJECT (self, "Failed to release output buffer index %d", idx); - if (err) + if (err && !self->flushing) GST_ELEMENT_WARNING_FROM_ERROR (self, err); + g_clear_error (&err); goto invalid_buffer; } @@ -1197,8 +1200,9 @@ gst_amc_video_dec_handle_frame (GstVideoDecoder * decoder, if (self->downstream_flow_ret != GST_FLOW_OK) { memset (&buffer_info, 0, sizeof (buffer_info)); gst_amc_codec_queue_input_buffer (self->codec, idx, &buffer_info, &err); - if (err) + if (err && !self->flushing) GST_ELEMENT_WARNING_FROM_ERROR (self, err); + g_clear_error (&err); goto downstream_error; } @@ -1363,8 +1367,13 @@ gst_amc_video_dec_drain (GstAmcVideoDec * self, gboolean at_eos) ret = GST_FLOW_OK; } else { GST_ERROR_OBJECT (self, "Failed to queue input buffer"); - GST_ELEMENT_WARNING_FROM_ERROR (self, err); - ret = GST_FLOW_ERROR; + if (self->flushing) { + g_clear_error (&err); + ret = GST_FLOW_FLUSHING; + } else { + GST_ELEMENT_WARNING_FROM_ERROR (self, err); + ret = GST_FLOW_ERROR; + } } g_mutex_unlock (&self->drain_lock); diff --git a/sys/androidmedia/gstamcvideoenc.c b/sys/androidmedia/gstamcvideoenc.c index b6de05d86..b85a4e269 100644 --- a/sys/androidmedia/gstamcvideoenc.c +++ b/sys/androidmedia/gstamcvideoenc.c @@ -1042,10 +1042,6 @@ process_buffer: GST_ERROR_OBJECT (self, "Invalid output buffer index %d of %d", idx, self->n_output_buffers); - if (!gst_amc_codec_release_output_buffer (self->codec, idx, &err)) - GST_ERROR_OBJECT (self, "Failed to release output buffer index %d", idx); - if (err) - GST_ELEMENT_WARNING_FROM_ERROR (self, err); goto invalid_buffer; } buf = &self->output_buffers[idx]; @@ -1482,8 +1478,9 @@ again: if (self->downstream_flow_ret != GST_FLOW_OK) { memset (&buffer_info, 0, sizeof (buffer_info)); gst_amc_codec_queue_input_buffer (self->codec, idx, &buffer_info, &err); - if (err) + if (err && !self->flushing) GST_ELEMENT_WARNING_FROM_ERROR (self, err); + g_clear_error (&err); goto downstream_error; } @@ -1501,8 +1498,9 @@ again: &buffer_info)) { memset (&buffer_info, 0, sizeof (buffer_info)); gst_amc_codec_queue_input_buffer (self->codec, idx, &buffer_info, &err); - if (err) + if (err && !self->flushing) GST_ELEMENT_WARNING_FROM_ERROR (self, err); + g_clear_error (&err); goto buffer_fill_error; } @@ -1620,7 +1618,9 @@ gst_amc_video_enc_finish (GstVideoEncoder * encoder) GST_DEBUG_OBJECT (self, "Sent EOS to the codec"); } else { GST_ERROR_OBJECT (self, "Failed to send EOS to the codec"); - GST_ELEMENT_WARNING_FROM_ERROR (self, err); + if (!self->flushing) + GST_ELEMENT_WARNING_FROM_ERROR (self, err); + g_clear_error (&err); } } else if (idx >= self->n_input_buffers) { GST_ERROR_OBJECT (self, "Invalid input buffer index %d of %d", @@ -1684,8 +1684,13 @@ gst_amc_video_enc_drain (GstAmcVideoEnc * self) ret = GST_FLOW_OK; } else { GST_ERROR_OBJECT (self, "Failed to queue input buffer"); - GST_ELEMENT_WARNING_FROM_ERROR (self, err); - ret = GST_FLOW_ERROR; + if (self->flushing) { + g_clear_error (&err); + ret = GST_FLOW_FLUSHING; + } else { + GST_ELEMENT_WARNING_FROM_ERROR (self, err); + ret = GST_FLOW_ERROR; + } } g_mutex_unlock (&self->drain_lock); |