aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-04-07 10:14:38 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-04-19 13:18:04 +0200
commit70e79d289b42d2e895dd4bab8324d0cbadf6a9df (patch)
tree0e239a04049156dc82ed9972f96f1d9e49669657
parent8dd0bd4f9b8de59c2731215f1611f337a19474cb (diff)
downloadffmpeg-70e79d289b42d2e895dd4bab8324d0cbadf6a9df.tar.gz
avcodec/wavpack: Only reset DSD context upon parameter change
The current code resets it all the time unless we are decoding a DSD frame with identical parameters to the last frame. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/wavpack.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 6fd297a002..51ac943fe7 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -1526,10 +1526,10 @@ static int wavpack_decode_block(AVCodecContext *avctx, AVFrame *frame, int block
}
/* clear DSD state if stream properties change */
- if (new_ch_layout.nb_channels != wc->dsd_channels ||
- av_channel_layout_compare(&new_ch_layout, &avctx->ch_layout) ||
- new_samplerate != avctx->sample_rate ||
- !!got_dsd != !!wc->dsdctx) {
+ if ((wc->dsdctx && !got_dsd) ||
+ got_dsd && (new_ch_layout.nb_channels != wc->dsd_channels ||
+ av_channel_layout_compare(&new_ch_layout, &avctx->ch_layout) ||
+ new_samplerate != avctx->sample_rate)) {
ret = wv_dsd_reset(wc, got_dsd ? new_ch_layout.nb_channels : 0);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Error reinitializing the DSD context\n");