... and fix a case where we released an invalid buffer index.
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;
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;
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;
}
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);
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;
}
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;
}
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;
}
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;
}
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);
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];
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;
}
&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;
}
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",
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);