mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-25 07:26:29 +00:00
ext/a52dec/gsta52dec.c: Actually leave the loop if we failed to sync. Don't crash.
Original commit message from CVS: * ext/a52dec/gsta52dec.c: (gst_a52dec_loop): Actually leave the loop if we failed to sync. Don't crash.
This commit is contained in:
parent
fb744af7a9
commit
0c8890af5d
2 changed files with 20 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2004-11-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
|
* ext/a52dec/gsta52dec.c: (gst_a52dec_loop):
|
||||||
|
Actually leave the loop if we failed to sync. Don't crash.
|
||||||
|
|
||||||
2004-11-28 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
2004-11-28 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_get_audio_stream),
|
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_get_audio_stream),
|
||||||
|
|
|
@ -364,7 +364,7 @@ gst_a52dec_loop (GstElement * element)
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
int i, length, flags, sample_rate, bit_rate;
|
int i, length, flags, sample_rate, bit_rate;
|
||||||
int channels;
|
int channels;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf = NULL;
|
||||||
guint32 got_bytes;
|
guint32 got_bytes;
|
||||||
gboolean need_reneg;
|
gboolean need_reneg;
|
||||||
GstClockTime timestamp = 0;
|
GstClockTime timestamp = 0;
|
||||||
|
@ -372,6 +372,9 @@ gst_a52dec_loop (GstElement * element)
|
||||||
a52dec = GST_A52DEC (element);
|
a52dec = GST_A52DEC (element);
|
||||||
|
|
||||||
/* find and read header */
|
/* find and read header */
|
||||||
|
bit_rate = a52dec->bit_rate;
|
||||||
|
sample_rate = a52dec->sample_rate;
|
||||||
|
flags = 0;
|
||||||
do {
|
do {
|
||||||
gint skipped_bytes = 0;
|
gint skipped_bytes = 0;
|
||||||
|
|
||||||
|
@ -386,11 +389,17 @@ gst_a52dec_loop (GstElement * element)
|
||||||
/* slide window to next 7 bytesa */
|
/* slide window to next 7 bytesa */
|
||||||
gst_bytestream_flush_fast (a52dec->bs, 1);
|
gst_bytestream_flush_fast (a52dec->bs, 1);
|
||||||
skipped_bytes++;
|
skipped_bytes++;
|
||||||
GST_LOG ("Skipped");
|
GST_DEBUG ("Skipped");
|
||||||
} else
|
} else {
|
||||||
|
GST_DEBUG ("Sync: %d", length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (skipped_bytes >= 3840) {
|
||||||
|
GST_LOG ("Sync failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
while (0);
|
while (0);
|
||||||
|
|
||||||
need_reneg = FALSE;
|
need_reneg = FALSE;
|
||||||
|
@ -400,7 +409,9 @@ gst_a52dec_loop (GstElement * element)
|
||||||
a52dec->sample_rate = sample_rate;
|
a52dec->sample_rate = sample_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flags) {
|
||||||
a52dec->stream_channels = flags & (A52_CHANNEL_MASK | A52_LFE);
|
a52dec->stream_channels = flags & (A52_CHANNEL_MASK | A52_LFE);
|
||||||
|
}
|
||||||
|
|
||||||
if (bit_rate != a52dec->bit_rate) {
|
if (bit_rate != a52dec->bit_rate) {
|
||||||
a52dec->bit_rate = bit_rate;
|
a52dec->bit_rate = bit_rate;
|
||||||
|
|
Loading…
Reference in a new issue