Browse Source

MT#55283 set frame size after avcodec_open2

The frame size might not be set before avcodec_open2 is called. Move
setting it to below the call.

Fixes MP3 recording output.

Change-Id: Ie81528e64c2497f769d19a5c54228bf0f5cd138d
(cherry picked from commit 7d37d8b835)
mr13.4
Richard Fuchs 4 months ago
parent
commit
51f6cd1633
1 changed files with 7 additions and 5 deletions
  1. +7
    -5
      lib/codeclib.c

+ 7
- 5
lib/codeclib.c View File

@ -1869,11 +1869,6 @@ static const char *avc_encoder_init(encoder_t *enc, const str *extra_opts) {
enc->avc.avcctx->time_base = (AVRational){1,enc->actual_format.clockrate};
enc->avc.avcctx->bit_rate = enc->bitrate;
enc->samples_per_frame = enc->actual_format.clockrate * enc->ptime / 1000;
if (enc->avc.avcctx->frame_size)
enc->samples_per_frame = enc->avc.avcctx->frame_size;
enc->samples_per_packet = enc->samples_per_frame;
if (enc->def->set_enc_options)
enc->def->set_enc_options(enc, extra_opts);
@ -1883,6 +1878,13 @@ static const char *avc_encoder_init(encoder_t *enc, const str *extra_opts) {
return "failed to open output context";
}
if (enc->avc.avcctx->frame_size)
enc->samples_per_frame = enc->avc.avcctx->frame_size;
else
enc->samples_per_frame = enc->actual_format.clockrate * enc->ptime / 1000;
enc->samples_per_packet = enc->samples_per_frame;
return NULL;
}


Loading…
Cancel
Save