[SCM] libav/master: Revert "lavf: eliminate ff_get_audio_frame_size()"

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Wed Sep 17 01:18:08 UTC 2014


The following commit has been merged in the master branch:
commit 04361427e65a687469a3bb0859971292d2dc11e4
Author: Andrew Stone <andrew at clovar.com>
Date:   Mon Aug 18 17:28:23 2014 -0400

    Revert "lavf: eliminate ff_get_audio_frame_size()"
    
    This reverts commit 30e50c50274f88f0f5ae829f401cd3c7f5266719.
    
    The original commit broke the ability to stream AAC over HTTP/Icecast. It looks
    like avformat_find_stream_info() gets stuck in an infinite loop, never hitting
    AVFormatContext.max_analyze_duration since duration is never set for any of
    the packets.
    
    Example stream: http://listen.classicrocklounge.com:8000/aac64
    
    Signed-off-by: Anton Khirnov <anton at khirnov.net>

diff --git a/libavformat/internal.h b/libavformat/internal.h
index 9921ce1..2824436 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -326,6 +326,8 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
 void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st,
                                AVCodecParserContext *pc, AVPacket *pkt);
 
+int ff_get_audio_frame_size(AVCodecContext *enc, int size, int mux);
+
 unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id);
 
 enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4cc246d..973ab94 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -454,6 +454,27 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
 /**********************************************************/
 
 /**
+ * Get the number of samples of an audio frame. Return -1 on error.
+ */
+int ff_get_audio_frame_size(AVCodecContext *enc, int size, int mux)
+{
+    int frame_size;
+
+    /* give frame_size priority if demuxing */
+    if (!mux && enc->frame_size > 1)
+        return enc->frame_size;
+
+    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;
+
+    return -1;
+}
+
+/**
  * Return the frame duration in seconds. Return 0 if not available.
  */
 void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st,
@@ -488,7 +509,7 @@ void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st,
         }
         break;
     case AVMEDIA_TYPE_AUDIO:
-        frame_size = av_get_audio_frame_duration(st->codec, pkt->size);
+        frame_size = ff_get_audio_frame_size(st->codec, pkt->size, 0);
         if (frame_size <= 0 || st->codec->sample_rate <= 0)
             break;
         *pnum = frame_size;

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list