diff options
author | jep <jep@2b0047a9-a6d8-0310-accf-f7200b2a168c> | 2012-08-22 14:31:24 +0000 |
---|---|---|
committer | jep <jep@2b0047a9-a6d8-0310-accf-f7200b2a168c> | 2012-08-22 14:31:24 +0000 |
commit | 100ac3d5f4e26d94c86a89a42ec87f42d1446f83 (patch) | |
tree | 5acc9debde34f3559753ada4c2f402a63fb1ddb9 | |
parent | eb13f1f3f71938b9b79f9b9aabc8277ab6707314 (diff) |
* src/bitstream.c: (h_setbuf), (h_reset):
* src/bitstream.h:
* src/mp3-c.c: (mp3_c_flush):
* src/mp3tl.c: (mp3tl_flush):
Flush the decoder some more.
git-svn-id: https://core.fluendo.com/gstreamer/svn/trunk/gst-fluendo-mp3@2333 2b0047a9-a6d8-0310-accf-f7200b2a168c
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/bitstream.c | 33 | ||||
-rw-r--r-- | src/bitstream.h | 1 | ||||
-rw-r--r-- | src/mp3-c.c | 2 | ||||
-rw-r--r-- | src/mp3tl.c | 6 |
5 files changed, 38 insertions, 12 deletions
@@ -1,3 +1,11 @@ +2012-08-22 Josep Torra <josep@fluendo.com> + + * src/bitstream.c: (h_setbuf), (h_reset): + * src/bitstream.h: + * src/mp3-c.c: (mp3_c_flush): + * src/mp3tl.c: (mp3tl_flush): + Flush the decoder some more. + 2012-07-04 Josep Torra <josep@fluendo.com> * src/mp3tl-priv.h: diff --git a/src/bitstream.c b/src/bitstream.c index c61bbce..187abff 100644 --- a/src/bitstream.c +++ b/src/bitstream.c @@ -361,20 +361,31 @@ h_setbuf (huffdec_bitbuf * bb, guint8 * buf, guint size) bb->buf_bit_idx = 8; bb->buf = buf; #if ENABLE_OPT_BS - /* First load of the accumulator, assumes that size >= 4 */ - bb->buf_bit_idx = 32; - bb->remaining = bb->avail - 4; - - /* we need reverse the byte order */ - bb->accumulator = (guint) bb->buf[3]; - bb->accumulator |= (guint) (bb->buf[2]) << 8; - bb->accumulator |= (guint) (bb->buf[1]) << 16; - bb->accumulator |= (guint) (bb->buf[0]) << 24; - - bb->buf_byte_idx += 4; + if (buf) { + /* First load of the accumulator, assumes that size >= 4 */ + bb->buf_bit_idx = 32; + bb->remaining = bb->avail - 4; + + /* we need reverse the byte order */ + bb->accumulator = (guint) buf[3]; + bb->accumulator |= (guint) (buf[2]) << 8; + bb->accumulator |= (guint) (buf[1]) << 16; + bb->accumulator |= (guint) (buf[0]) << 24; + + bb->buf_byte_idx += 4; + } else { + bb->remaining = 0; + bb->accumulator = 0; + } #endif } +void +h_reset (huffdec_bitbuf * bb) +{ + h_setbuf (bb, NULL, 0); +} + #if ENABLE_OPT_BS void h_rewindNbits (huffdec_bitbuf * bb, guint N) diff --git a/src/bitstream.h b/src/bitstream.h index 8f1f8f9..c069946 100644 --- a/src/bitstream.h +++ b/src/bitstream.h @@ -143,6 +143,7 @@ typedef struct /* Huffman Decoder bit buffer functions */ void h_setbuf (huffdec_bitbuf * bb, guint8 * buf, guint size); +void h_reset (huffdec_bitbuf * bb); #if ENABLE_OPT_BS static inline guint32 h_get1bit (huffdec_bitbuf * bb); diff --git a/src/mp3-c.c b/src/mp3-c.c index d8a281e..07b5d7b 100644 --- a/src/mp3-c.c +++ b/src/mp3-c.c @@ -1818,5 +1818,7 @@ void mp3_c_flush (mp3tl * tl) { init_hybrid (&tl->c_impl); + h_reset (&tl->c_impl.bb); + memset (tl->c_impl.hb_buf, 0, HDBB_BUFSIZE); tl->c_impl.main_data_end = 0; } diff --git a/src/mp3tl.c b/src/mp3tl.c index 8440738..9d159c9 100644 --- a/src/mp3tl.c +++ b/src/mp3tl.c @@ -493,8 +493,12 @@ mp3tl_flush (mp3tl * tl) tl->need_sync = TRUE; tl->lost_sync = TRUE; - tl->frame_ts = GST_CLOCK_TIME_NONE; + init_syn_filter (&tl->fr_ps); + tl->frame_ts = GST_CLOCK_TIME_NONE; + tl->sample_buf = NULL; + tl->sample_w = 0; + memset (tl->pcm_sample, 0, sizeof (tl->pcm_sample)); /* Call decoder specific flush routines */ #ifdef USE_IPP mp3_ipp_flush (tl); |