diff options
author | Paul B Mahol <onemda@gmail.com> | 2023-10-09 21:16:15 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2023-10-09 21:23:25 +0200 |
commit | 1703bfa133ffebf0234a20199d54c27e0a5ffd0c (patch) | |
tree | 13af89921d8145baa8cbb4390792ddc0e9267c85 | |
parent | 8b6ee74d50708e593c258726c5c29fddbf2765ab (diff) | |
download | ffmpeg-1703bfa133ffebf0234a20199d54c27e0a5ffd0c.tar.gz |
avcodec/hcadec: implement proper .flush callback
-rw-r--r-- | libavcodec/hcadec.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c index 4e30d553de..026b998341 100644 --- a/libavcodec/hcadec.c +++ b/libavcodec/hcadec.c @@ -65,7 +65,7 @@ typedef struct HCAContext { uint8_t stereo_band_count; uint8_t bands_per_hfr_group; - // Set during init() and freed on close(). Untouched on flush() + // Set during init() and freed on close(). Untouched on init_flush() av_tx_fn tx_fn; AVTXContext *tx_ctx; AVFloatDSPContext *fdsp; @@ -197,7 +197,7 @@ static inline unsigned ceil2(unsigned a, unsigned b) return (b > 0) ? (a / b + ((a % b) ? 1 : 0)) : 0; } -static av_cold void decode_flush(AVCodecContext *avctx) +static av_cold void init_flush(AVCodecContext *avctx) { HCAContext *c = avctx->priv_data; @@ -213,7 +213,7 @@ static int init_hca(AVCodecContext *avctx, const uint8_t *extradata, unsigned b, chunk; int version, ret; - decode_flush(avctx); + init_flush(avctx); if (extradata_size < 36) return AVERROR_INVALIDDATA; @@ -609,6 +609,14 @@ static av_cold int decode_close(AVCodecContext *avctx) return 0; } +static av_cold void decode_flush(AVCodecContext *avctx) +{ + HCAContext *c = avctx->priv_data; + + for (int ch = 0; ch < MAX_CHANNELS; ch++) + memset(c->ch[ch].imdct_prev, 0, sizeof(c->ch[ch].imdct_prev)); +} + const FFCodec ff_hca_decoder = { .p.name = "hca", CODEC_LONG_NAME("CRI HCA"), |