Fixes ticket #10732
Showing the changes to libavcodec (4 of 4 files). Show all
Unified · Split
| @@ -252,6 +252,16 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) · 251 unmodified lines | |||
| 252 | return 0; | 252 | return 0; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | static av_cold void ac3_decode_flush(AVCodecContext *avctx) | ||
| 256 | { | ||
| 257 | AC3DecodeContext *s = avctx->priv_data; | ||
| 258 | |||
| 259 | memset(&s->frame_type, 0, sizeof(*s) - offsetof(AC3DecodeContext, frame_type)); | ||
| 260 | |||
| 261 | AC3_RENAME(ff_kbd_window_init)(s->window, 5.0, 256); | ||
| 262 | av_lfg_init(&s->dith_state, 0); | ||
| 263 | } | ||
| 264 | |||
| 255 | /** | 265 | /** |
| 256 | * Parse the 'sync info' and 'bit stream info' from the AC-3 bitstream. | 266 | * Parse the 'sync info' and 'bit stream info' from the AC-3 bitstream. |
| 257 | * GetBitContext within AC3DecodeContext must point to | 267 | * GetBitContext within AC3DecodeContext must point to |
| @@ -96,6 +96,7 @@ typedef struct AC3DecodeContext { · 95 unmodified lines | |||
| 96 | SHORTFLOAT *downmix_coeffs[2]; ///< stereo downmix coefficients | 96 | SHORTFLOAT *downmix_coeffs[2]; ///< stereo downmix coefficients |
| 97 | 97 | ||
| 98 | // Start of flushable fields. | 98 | // Start of flushable fields. |
| 99 | // frame_type must be the flushable field, or the offset changed in ac3_decode_flush(). | ||
| 99 | 100 | ||
| 100 | ///@name Bit stream information | 101 | ///@name Bit stream information |
| 101 | ///@{ | 102 | ///@{ |
| @@ -181,6 +181,7 @@ const FFCodec ff_ac3_fixed_decoder = { · 180 unmodified lines | |||
| 181 | .p.priv_class = &ac3_decoder_class, | 181 | .p.priv_class = &ac3_decoder_class, |
| 182 | .priv_data_size = sizeof (AC3DecodeContext), | 182 | .priv_data_size = sizeof (AC3DecodeContext), |
| 183 | .init = ac3_decode_init, | 183 | .init = ac3_decode_init, |
| 184 | .flush = ac3_decode_flush, | ||
| 184 | .close = ac3_decode_end, | 185 | .close = ac3_decode_end, |
| 185 | FF_CODEC_DECODE_CB(ac3_decode_frame), | 186 | FF_CODEC_DECODE_CB(ac3_decode_frame), |
| 186 | .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | | 187 | .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | |
| @@ -70,6 +70,7 @@ const FFCodec ff_ac3_decoder = { · 69 unmodified lines | |||
| 70 | .p.id = AV_CODEC_ID_AC3, | 70 | .p.id = AV_CODEC_ID_AC3, |
| 71 | .priv_data_size = sizeof (AC3DecodeContext), | 71 | .priv_data_size = sizeof (AC3DecodeContext), |
| 72 | .init = ac3_decode_init, | 72 | .init = ac3_decode_init, |
| 73 | .flush = ac3_decode_flush, | ||
| 73 | .close = ac3_decode_end, | 74 | .close = ac3_decode_end, |
| 74 | FF_CODEC_DECODE_CB(ac3_decode_frame), | 75 | FF_CODEC_DECODE_CB(ac3_decode_frame), |
| 75 | .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | | 76 | .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | |
| @@ -88,6 +89,7 @@ const FFCodec ff_eac3_decoder = { · 12 unmodified lines | |||
| 88 | .p.id = AV_CODEC_ID_EAC3, | 89 | .p.id = AV_CODEC_ID_EAC3, |
| 89 | .priv_data_size = sizeof (AC3DecodeContext), | 90 | .priv_data_size = sizeof (AC3DecodeContext), |
| 90 | .init = ac3_decode_init, | 91 | .init = ac3_decode_init, |
| 92 | .flush = ac3_decode_flush, | ||
| 91 | .close = ac3_decode_end, | 93 | .close = ac3_decode_end, |
| 92 | FF_CODEC_DECODE_CB(ac3_decode_frame), | 94 | FF_CODEC_DECODE_CB(ac3_decode_frame), |
| 93 | .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | | 95 | .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | |