androidmedia: Clean up flushing code and don't consider output buffer releasing failures during flushing as an error

This commit is contained in:
Sebastian Dröge 2014-06-19 11:12:47 +02:00
parent e3af42ae82
commit 71c0e0e19f
3 changed files with 35 additions and 11 deletions

View file

@ -562,8 +562,13 @@ retry:
}
done:
if (!gst_amc_codec_release_output_buffer (self->codec, idx, &err))
if (!gst_amc_codec_release_output_buffer (self->codec, idx, &err)) {
if (self->flushing) {
g_clear_error (&err);
goto flushing;
}
goto failed_release;
}
if (is_eos || flow_ret == GST_FLOW_EOS) {
GST_AUDIO_DECODER_STREAM_UNLOCK (self);
@ -1054,7 +1059,7 @@ gst_amc_audio_dec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf)
GST_AUDIO_DECODER_STREAM_LOCK (self);
if (idx < 0) {
if (self->flushing) {
if (self->flushing || self->downstream_flow_ret == GST_FLOW_FLUSHING) {
g_clear_error (&err);
goto flushing;
}
@ -1078,8 +1083,11 @@ gst_amc_audio_dec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf)
if (idx >= self->n_input_buffers)
goto invalid_buffer_index;
if (self->flushing)
if (self->flushing) {
memset (&buffer_info, 0, sizeof (buffer_info));
gst_amc_codec_queue_input_buffer (self->codec, idx, &buffer_info, NULL);
goto flushing;
}
if (self->downstream_flow_ret != GST_FLOW_OK) {
memset (&buffer_info, 0, sizeof (buffer_info));

View file

@ -601,7 +601,7 @@ retry:
/*} */
if (idx < 0) {
if (self->flushing || self->downstream_flow_ret == GST_FLOW_FLUSHING) {
if (self->flushing) {
g_clear_error (&err);
goto flushing;
}
@ -745,8 +745,13 @@ retry:
flow_ret = gst_video_decoder_drop_frame (GST_VIDEO_DECODER (self), frame);
}
if (!gst_amc_codec_release_output_buffer (self->codec, idx, &err))
if (!gst_amc_codec_release_output_buffer (self->codec, idx, &err)) {
if (self->flushing) {
g_clear_error (&err);
goto flushing;
}
goto failed_release;
}
if (is_eos || flow_ret == GST_FLOW_EOS) {
GST_VIDEO_DECODER_STREAM_UNLOCK (self);
@ -1159,7 +1164,7 @@ gst_amc_video_dec_handle_frame (GstVideoDecoder * decoder,
GST_VIDEO_DECODER_STREAM_LOCK (self);
if (idx < 0) {
if (self->flushing) {
if (self->flushing || self->downstream_flow_ret == GST_FLOW_FLUSHING) {
g_clear_error (&err);
goto flushing;
}
@ -1183,8 +1188,11 @@ gst_amc_video_dec_handle_frame (GstVideoDecoder * decoder,
if (idx >= self->n_input_buffers)
goto invalid_buffer_index;
if (self->flushing)
if (self->flushing) {
memset (&buffer_info, 0, sizeof (buffer_info));
gst_amc_codec_queue_input_buffer (self->codec, idx, &buffer_info, NULL);
goto flushing;
}
if (self->downstream_flow_ret != GST_FLOW_OK) {
memset (&buffer_info, 0, sizeof (buffer_info));

View file

@ -936,7 +936,7 @@ retry:
/*} */
if (idx < 0 || self->amc_format) {
if (self->flushing || self->downstream_flow_ret == GST_FLOW_FLUSHING) {
if (self->flushing) {
g_clear_error (&err);
goto flushing;
}
@ -1053,8 +1053,13 @@ process_buffer:
flow_ret =
gst_amc_video_enc_handle_output_frame (self, buf, &buffer_info, frame);
if (!gst_amc_codec_release_output_buffer (self->codec, idx, &err))
if (!gst_amc_codec_release_output_buffer (self->codec, idx, &err)) {
if (self->flushing) {
g_clear_error (&err);
goto flushing;
}
goto failed_release;
}
if (is_eos || flow_ret == GST_FLOW_EOS) {
GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
@ -1444,7 +1449,7 @@ again:
GST_VIDEO_ENCODER_STREAM_LOCK (self);
if (idx < 0) {
if (self->flushing) {
if (self->flushing || self->downstream_flow_ret == GST_FLOW_FLUSHING) {
g_clear_error (&err);
goto flushing;
}
@ -1468,8 +1473,11 @@ again:
if (idx >= self->n_input_buffers)
goto invalid_buffer_index;
if (self->flushing)
if (self->flushing) {
memset (&buffer_info, 0, sizeof (buffer_info));
gst_amc_codec_queue_input_buffer (self->codec, idx, &buffer_info, NULL);
goto flushing;
}
if (self->downstream_flow_ret != GST_FLOW_OK) {
memset (&buffer_info, 0, sizeof (buffer_info));