History

avcodec/hcadec: implement proper .flush callback

Paul B Mahol committed 3 years ago

Commit 1703bfa1 parent 8b6ee741 file · +11 −3Browse files

Unified · Split

libavcodec/hcadec.c+11−3
@@ -65,7 +65,7 @@ typedef struct HCAContext { · 64 unmodified lines
6565 uint8_t stereo_band_count;
6666 uint8_t bands_per_hfr_group;
6767
68− // Set during init() and freed on close(). Untouched on flush()
68+ // Set during init() and freed on close(). Untouched on init_flush()
6969 av_tx_fn tx_fn;
7070 AVTXContext *tx_ctx;
7171 AVFloatDSPContext *fdsp;
@@ -197,7 +197,7 @@ static inline unsigned ceil2(unsigned a, unsigned b) · 125 unmodified lines
197197 return (b > 0) ? (a / b + ((a % b) ? 1 : 0)) : 0;
198198 }
199199
200−static av_cold void decode_flush(AVCodecContext *avctx)
200+static av_cold void init_flush(AVCodecContext *avctx)
201201 {
202202 HCAContext *c = avctx->priv_data;
203203
@@ -213,7 +213,7 @@ static int init_hca(AVCodecContext *avctx, const uint8_t *extradata, · 9 unmodified lines
213213 unsigned b, chunk;
214214 int version, ret;
215215
216− decode_flush(avctx);
216+ init_flush(avctx);
217217
218218 if (extradata_size < 36)
219219 return AVERROR_INVALIDDATA;
@@ -609,6 +609,14 @@ static av_cold int decode_close(AVCodecContext *avctx) · 389 unmodified lines
609609 return 0;
610610 }
611611
612+static av_cold void decode_flush(AVCodecContext *avctx)
613+{
614+ HCAContext *c = avctx->priv_data;
615+
616+ for (int ch = 0; ch < MAX_CHANNELS; ch++)
617+ memset(c->ch[ch].imdct_prev, 0, sizeof(c->ch[ch].imdct_prev));
618+}
619+
612620 const FFCodec ff_hca_decoder = {
613621 .p.name = "hca",
614622 CODEC_LONG_NAME("CRI HCA"),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t