[SCM] libav/experimental: Introduce a new num_frames field in RTPDemuxContext so that rtp_aac.c does not need to abuse read_buf_index

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:36:56 UTC 2013


The following commit has been merged in the experimental branch:
commit 21da81d7844237609bba1f02cec8eff936055f4d
Author: Luca Abeni <lucabe72 at email.it>
Date:   Thu Feb 5 14:53:25 2009 +0000

    Introduce a new num_frames field in RTPDemuxContext so that rtp_aac.c
    does not need to abuse read_buf_index
    
    Originally committed as revision 17004 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/rtp.h b/libavformat/rtp.h
index 98c2dc7..1690be2 100644
--- a/libavformat/rtp.h
+++ b/libavformat/rtp.h
@@ -154,6 +154,7 @@ struct RTPDemuxContext {
     struct MpegTSContext *ts;   /* only used for MP2T payloads */
     int read_buf_index;
     int read_buf_size;
+    int num_frames;
     /* used to send back RTCP RR */
     URLContext *rtp_ctx;
     char hostname[256];
diff --git a/libavformat/rtp_aac.c b/libavformat/rtp_aac.c
index e54ff3f..71ca9c6 100644
--- a/libavformat/rtp_aac.c
+++ b/libavformat/rtp_aac.c
@@ -40,8 +40,8 @@ void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size)
 
     /* test if the packet must be sent */
     len = (s->buf_ptr - s->buf);
-    if ((s->read_buf_index == MAX_FRAMES_PER_PACKET) || (len && (len + size) > max_packet_size)) {
-        int au_size = s->read_buf_index * 2;
+    if ((s->num_frames == MAX_FRAMES_PER_PACKET) || (len && (len + size) > max_packet_size)) {
+        int au_size = s->num_frames * 2;
 
         p = s->buf + MAX_AU_HEADERS_SIZE - au_size - 2;
         if (p != s->buf) {
@@ -53,15 +53,15 @@ void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size)
 
         ff_rtp_send_data(s1, p, s->buf_ptr - p, 1);
 
-        s->read_buf_index = 0;
+        s->num_frames = 0;
     }
-    if (s->read_buf_index == 0) {
+    if (s->num_frames == 0) {
         s->buf_ptr = s->buf + MAX_AU_HEADERS_SIZE;
         s->timestamp = s->cur_timestamp;
     }
 
     if (size < max_packet_size) {
-        p = s->buf + s->read_buf_index++ * 2 + 2;
+        p = s->buf + s->num_frames++ * 2 + 2;
         *p++ = size >> 5;
         *p = (size & 0x1F) << 3;
         memcpy(s->buf_ptr, buff, size);
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 389e3c7..32b160e 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -102,7 +102,7 @@ static int rtp_write_header(AVFormatContext *s1)
         s->buf_ptr = s->buf;
         break;
     case CODEC_ID_AAC:
-        s->read_buf_index = 0;
+        s->num_frames = 0;
     default:
         if (st->codec->codec_type == CODEC_TYPE_AUDIO) {
             av_set_pts_info(st, 32, 1, st->codec->sample_rate);

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list