History

avcodec/wmaprodec: Avoid branch for setting block_align

Andreas Rheinhardt committed 1 year ago

Commit 725563a1 parent 66acbb91 file · +7 −8Browse files

Unified · Split

libavcodec/wmaprodec.c+7−8
@@ -370,14 +370,6 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int nu · 369 unmodified lines
370370 int log2_max_num_subframes;
371371 int num_possible_block_sizes;
372372
373− if (avctx->codec_id == AV_CODEC_ID_XMA1 || avctx->codec_id == AV_CODEC_ID_XMA2)
374− avctx->block_align = 2048;
375−
376− if (!avctx->block_align) {
377− av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
378− return AVERROR(EINVAL);
379− }
380−
381373 s->avctx = avctx;
382374
383375 init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
@@ -603,6 +595,11 @@ static av_cold int wmapro_decode_init(AVCodecContext *avctx) · 219 unmodified lines
603595 {
604596 WMAProDecodeCtx *s = avctx->priv_data;
605597
598+ if (!avctx->block_align) {
599+ av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
600+ return AVERROR(EINVAL);
601+ }
602+
606603 return decode_init(s, avctx, 0);
607604 }
608605
@@ -1957,6 +1954,8 @@ static av_cold int xma_decode_init(AVCodecContext *avctx) · 1348 unmodified lines
19571954 XMADecodeCtx *s = avctx->priv_data;
19581955 int i, ret, start_channels = 0;
19591956
1957+ avctx->block_align = 2048;
1958+
19601959 if (avctx->ch_layout.nb_channels <= 0 || avctx->extradata_size == 0)
19611960 return AVERROR_INVALIDDATA;
19621961

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