aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtpenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-03-01 01:23:32 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-01 01:23:37 +0100
commita2c4c30b5f6111f977c5a7284ed625b3eb8db132 (patch)
tree607ef4b58aa14a24dbba710b195c11b455a42073 /libavformat/rtpenc.c
parent9e09931fb6a42446c3e370006eb585d0bbd4f501 (diff)
parentf8c01257f93ceda3e03bc4e540a51022d1e2bff2 (diff)
downloadffmpeg-a2c4c30b5f6111f977c5a7284ed625b3eb8db132.tar.gz
Merge commit 'f8c01257f93ceda3e03bc4e540a51022d1e2bff2'
* commit 'f8c01257f93ceda3e03bc4e540a51022d1e2bff2': rtpenc: Always do the default initialization regardless of codecs Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rtpenc.c')
-rw-r--r--libavformat/rtpenc.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index ac5ad8ea60..e6dc87a7d3 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -179,11 +179,17 @@ static int rtp_write_header(AVFormatContext *s1)
}
}
- avpriv_set_pts_info(st, 32, 1, 90000);
+ if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
+ avpriv_set_pts_info(st, 32, 1, st->codec->sample_rate);
+ } else {
+ avpriv_set_pts_info(st, 32, 1, 90000);
+ }
+ s->buf_ptr = s->buf;
switch(st->codec->codec_id) {
case AV_CODEC_ID_MP2:
case AV_CODEC_ID_MP3:
s->buf_ptr = s->buf + 4;
+ avpriv_set_pts_info(st, 32, 1, 90000);
break;
case AV_CODEC_ID_MPEG1VIDEO:
case AV_CODEC_ID_MPEG2VIDEO:
@@ -227,7 +233,7 @@ static int rtp_write_header(AVFormatContext *s1)
s->max_frames_per_packet = 15;
s->max_frames_per_packet = av_clip(s->max_frames_per_packet, 1, 15);
s->num_frames = 0;
- goto defaultcase;
+ break;
case AV_CODEC_ID_ADPCM_G722:
/* Due to a historical error, the clock rate for G722 in RTP is
* 8000, even if the sample rate is 16000. See RFC 3551. */
@@ -252,7 +258,7 @@ static int rtp_write_header(AVFormatContext *s1)
s->max_frames_per_packet = 1;
s->max_frames_per_packet = FFMIN(s->max_frames_per_packet,
s->max_payload_size / st->codec->block_align);
- goto defaultcase;
+ break;
case AV_CODEC_ID_AMR_NB:
case AV_CODEC_ID_AMR_WB:
if (!s->max_frames_per_packet)
@@ -271,18 +277,13 @@ static int rtp_write_header(AVFormatContext *s1)
goto fail;
}
s->num_frames = 0;
- goto defaultcase;
+ break;
case AV_CODEC_ID_AAC:
s->num_frames = 0;
if (!s->max_frames_per_packet)
s->max_frames_per_packet = 5;
- goto defaultcase;
+ break;
default:
-defaultcase:
- if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
- avpriv_set_pts_info(st, 32, 1, st->codec->sample_rate);
- }
- s->buf_ptr = s->buf;
break;
}