mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
androidmedia: Also don't report warnings for queue/dequeue errors during flushing in error cases
... and fix a case where we released an invalid buffer index.
This commit is contained in:
parent
880f3d8a18
commit
aee9d12b86
3 changed files with 42 additions and 20 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue