androidmedia: Handle queue/release errors non-fatal

They can happen sometimes as a transient problem, e.g. if there
is a problem in the stream. Only handle them as fatal if many of
them happen in a row.
This commit is contained in:
Sebastian Dröge 2014-07-17 10:53:30 +02:00
parent 589407a077
commit 774866ad62
2 changed files with 24 additions and 4 deletions

View file

@ -43,6 +43,16 @@
GST_DEBUG_CATEGORY_STATIC (gst_amc_audio_dec_debug_category); GST_DEBUG_CATEGORY_STATIC (gst_amc_audio_dec_debug_category);
#define GST_CAT_DEFAULT gst_amc_audio_dec_debug_category #define GST_CAT_DEFAULT gst_amc_audio_dec_debug_category
#define GST_AUDIO_DECODER_ERROR_FROM_ERROR(el, err) G_STMT_START { \
gchar *__dbg = g_strdup (err->message); \
GstAudioDecoder *__dec = GST_AUDIO_DECODER (el); \
GST_WARNING_OBJECT (el, "error: %s", __dbg); \
_gst_audio_decoder_error (__dec, 1, \
err->domain, err->code, \
NULL, __dbg, __FILE__, GST_FUNCTION, __LINE__); \
g_clear_error (&err); \
} G_STMT_END
/* prototypes */ /* prototypes */
static void gst_amc_audio_dec_finalize (GObject * object); static void gst_amc_audio_dec_finalize (GObject * object);
@ -630,7 +640,7 @@ format_error:
} }
failed_release: failed_release:
{ {
GST_ELEMENT_ERROR_FROM_ERROR (self, err); GST_AUDIO_DECODER_ERROR_FROM_ERROR (self, err);
gst_pad_push_event (GST_AUDIO_DECODER_SRC_PAD (self), gst_event_new_eos ()); gst_pad_push_event (GST_AUDIO_DECODER_SRC_PAD (self), gst_event_new_eos ());
gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self)); gst_pad_pause_task (GST_AUDIO_DECODER_SRC_PAD (self));
self->downstream_flow_ret = GST_FLOW_ERROR; self->downstream_flow_ret = GST_FLOW_ERROR;
@ -1193,7 +1203,7 @@ dequeue_error:
} }
queue_error: queue_error:
{ {
GST_ELEMENT_ERROR_FROM_ERROR (self, err); GST_AUDIO_DECODER_ERROR_FROM_ERROR (self, err);
if (minfo.data) if (minfo.data)
gst_buffer_unmap (inbuf, &minfo); gst_buffer_unmap (inbuf, &minfo);
if (inbuf) if (inbuf)

View file

@ -46,6 +46,16 @@
GST_DEBUG_CATEGORY_STATIC (gst_amc_video_dec_debug_category); GST_DEBUG_CATEGORY_STATIC (gst_amc_video_dec_debug_category);
#define GST_CAT_DEFAULT gst_amc_video_dec_debug_category #define GST_CAT_DEFAULT gst_amc_video_dec_debug_category
#define GST_VIDEO_DECODER_ERROR_FROM_ERROR(el, err) G_STMT_START { \
gchar *__dbg = g_strdup (err->message); \
GstVideoDecoder *__dec = GST_VIDEO_DECODER (el); \
GST_WARNING_OBJECT (el, "error: %s", __dbg); \
_gst_video_decoder_error (__dec, 1, \
err->domain, err->code, \
NULL, __dbg, __FILE__, GST_FUNCTION, __LINE__); \
g_clear_error (&err); \
} G_STMT_END
typedef struct _BufferIdentification BufferIdentification; typedef struct _BufferIdentification BufferIdentification;
struct _BufferIdentification struct _BufferIdentification
{ {
@ -825,7 +835,7 @@ format_error:
} }
failed_release: failed_release:
{ {
GST_ELEMENT_ERROR_FROM_ERROR (self, err); GST_VIDEO_DECODER_ERROR_FROM_ERROR (self, err);
gst_pad_push_event (GST_VIDEO_DECODER_SRC_PAD (self), gst_event_new_eos ()); gst_pad_push_event (GST_VIDEO_DECODER_SRC_PAD (self), gst_event_new_eos ());
gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self)); gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
self->downstream_flow_ret = GST_FLOW_ERROR; self->downstream_flow_ret = GST_FLOW_ERROR;
@ -1304,7 +1314,7 @@ dequeue_error:
} }
queue_error: queue_error:
{ {
GST_ELEMENT_ERROR_FROM_ERROR (self, err); GST_VIDEO_DECODER_ERROR_FROM_ERROR (self, err);
if (minfo.data) if (minfo.data)
gst_buffer_unmap (frame->input_buffer, &minfo); gst_buffer_unmap (frame->input_buffer, &minfo);
gst_video_codec_frame_unref (frame); gst_video_codec_frame_unref (frame);