summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-02-21 10:55:18 +0100
committerAnton Khirnov <anton@khirnov.net>2016-02-22 11:28:00 +0100
commitdc6527ed908e4d330738f139074455ffbe56a2de (patch)
tree3bf75f1727a54cfa4754d94ae37c92019801ba95 /libavformat
parentbf7be043fcfda29c81ef2268885b4ccc643e7c49 (diff)
nutenc: do not use AVCodecContext.frame_size
It will in general not be available. Use block_align if known or fall back to av_get_audio_frame_duration().
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/nutenc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index be6579dadb..7b69ff3099 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -190,9 +190,16 @@ static void build_frame_code(AVFormatContext *s)
key_frame = intra_only;
if (is_audio) {
- int frame_bytes = codec->frame_size * (int64_t)codec->bit_rate /
- (8 * codec->sample_rate);
+ int frame_bytes;
int pts;
+
+ if (codec->block_align > 0) {
+ frame_bytes = codec->block_align;
+ } else {
+ int frame_size = av_get_audio_frame_duration(codec, 0);
+ frame_bytes = frame_size * (int64_t)codec->bit_rate / (8 * codec->sample_rate);
+ }
+
for (pts = 0; pts < 2; pts++)
for (pred = 0; pred < 2; pred++) {
FrameCode *ft = &nut->frame_code[start2];