From ed488d1535d9e7b729dda2a6ffe8ecff481dad83 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Thu, 14 Aug 2014 02:42:14 +0200
Subject: [PATCH] Move frame_size fallback from ff_get_audio_frame_size() to
 av_get_audio_frame_duration()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
 libavcodec/utils.c  | 4 ++++
 libavformat/utils.c | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index de371e8a815..4531311f639 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -3306,6 +3306,10 @@ int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
         }
     }
 
+    /* Fall back on using frame_size */
+    if (avctx->frame_size > 1 && frame_bytes)
+        return avctx->frame_size;
+
     return 0;
 }
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index f995c4f7a56..c695e372a30 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -722,10 +722,6 @@ int ff_get_audio_frame_size(AVCodecContext *enc, int size, int mux)
     if ((frame_size = av_get_audio_frame_duration(enc, size)) > 0)
         return frame_size;
 
-    /* Fall back on using frame_size if muxing. */
-    if (enc->frame_size > 1)
-        return enc->frame_size;
-
     //For WMA we currently have no other means to calculate duration thus we
     //do it here by assuming CBR, which is true for all known cases.
     if (!mux && enc->bit_rate>0 && size>0 && enc->sample_rate>0 && enc->block_align>1) {
-- 
GitLab