mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +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>
|
||||
|
||||
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_get_audio_stream),
|
||||
|
|
|
@ -364,7 +364,7 @@ gst_a52dec_loop (GstElement * element)
|
|||
guint8 *data;
|
||||
int i, length, flags, sample_rate, bit_rate;
|
||||
int channels;
|
||||
GstBuffer *buf;
|
||||
GstBuffer *buf = NULL;
|
||||
guint32 got_bytes;
|
||||
gboolean need_reneg;
|
||||
GstClockTime timestamp = 0;
|
||||
|
@ -372,6 +372,9 @@ gst_a52dec_loop (GstElement * element)
|
|||
a52dec = GST_A52DEC (element);
|
||||
|
||||
/* find and read header */
|
||||
bit_rate = a52dec->bit_rate;
|
||||
sample_rate = a52dec->sample_rate;
|
||||
flags = 0;
|
||||
do {
|
||||
gint skipped_bytes = 0;
|
||||
|
||||
|
@ -386,9 +389,15 @@ gst_a52dec_loop (GstElement * element)
|
|||
/* slide window to next 7 bytesa */
|
||||
gst_bytestream_flush_fast (a52dec->bs, 1);
|
||||
skipped_bytes++;
|
||||
GST_LOG ("Skipped");
|
||||
} else
|
||||
GST_DEBUG ("Skipped");
|
||||
} else {
|
||||
GST_DEBUG ("Sync: %d", length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (skipped_bytes >= 3840) {
|
||||
GST_LOG ("Sync failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
while (0);
|
||||
|
@ -400,7 +409,9 @@ gst_a52dec_loop (GstElement * element)
|
|||
a52dec->sample_rate = sample_rate;
|
||||
}
|
||||
|
||||
a52dec->stream_channels = flags & (A52_CHANNEL_MASK | A52_LFE);
|
||||
if (flags) {
|
||||
a52dec->stream_channels = flags & (A52_CHANNEL_MASK | A52_LFE);
|
||||
}
|
||||
|
||||
if (bit_rate != a52dec->bit_rate) {
|
||||
a52dec->bit_rate = bit_rate;
|
||||
|
|
Loading…
Reference in a new issue