mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
faad: do not attempt to sync indefinitely
This commit is contained in:
parent
159fe8a1a0
commit
b4739124dc
2 changed files with 17 additions and 1 deletions
|
@ -246,6 +246,7 @@ gst_faad_reset (GstFaad * faad)
|
|||
faad->bytes_in = 0;
|
||||
faad->sum_dur_out = 0;
|
||||
faad->error_count = 0;
|
||||
faad->sync_flush = 0;
|
||||
gst_adapter_clear (faad->adapter);
|
||||
clear_queued (faad);
|
||||
}
|
||||
|
@ -971,6 +972,8 @@ looks_like_valid_header (guint8 * input_data, guint input_size)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#define FAAD_MAX_SYNC 10 * 8 * 1024
|
||||
|
||||
static GstFlowReturn
|
||||
gst_faad_chain (GstPad * pad, GstBuffer * buffer)
|
||||
{
|
||||
|
@ -1021,9 +1024,14 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer)
|
|||
|
||||
if (!faad->packetised) {
|
||||
if (!gst_faad_sync (faad, input_data, input_size, &sync_off)) {
|
||||
faad->sync_flush += sync_off;
|
||||
input_size -= sync_off;
|
||||
goto out;
|
||||
if (faad->sync_flush > FAAD_MAX_SYNC)
|
||||
goto parse_failed;
|
||||
else
|
||||
goto out;
|
||||
} else {
|
||||
faad->sync_flush = 0;
|
||||
input_data += sync_off;
|
||||
input_size -= sync_off;
|
||||
}
|
||||
|
@ -1203,6 +1211,13 @@ sample_overflow:
|
|||
ret = GST_FLOW_ERROR;
|
||||
goto out;
|
||||
}
|
||||
parse_failed:
|
||||
{
|
||||
GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL),
|
||||
("failed to parse non-packetized stream"));
|
||||
ret = GST_FLOW_ERROR;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -68,6 +68,7 @@ typedef struct _GstFaad {
|
|||
guint64 sum_dur_out; /* sum of durations of decoded buffers we sent out */
|
||||
gint error_count;
|
||||
gboolean discont;
|
||||
gint sync_flush;
|
||||
|
||||
/* segment handling */
|
||||
GstSegment segment;
|
||||
|
|
Loading…
Reference in a new issue