Commit ba069e08 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '0662440b'

* commit '0662440b':
  rtpenc_aac: Set a default value for max_frames_per_packet at init
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 6f0a8296 0662440b
...@@ -274,6 +274,8 @@ static int rtp_write_header(AVFormatContext *s1) ...@@ -274,6 +274,8 @@ static int rtp_write_header(AVFormatContext *s1)
goto defaultcase; goto defaultcase;
case AV_CODEC_ID_AAC: case AV_CODEC_ID_AAC:
s->num_frames = 0; s->num_frames = 0;
if (!s->max_frames_per_packet)
s->max_frames_per_packet = 5;
goto defaultcase; goto defaultcase;
default: default:
defaultcase: defaultcase:
......
...@@ -27,8 +27,7 @@ void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size) ...@@ -27,8 +27,7 @@ void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size)
RTPMuxContext *s = s1->priv_data; RTPMuxContext *s = s1->priv_data;
int len, max_packet_size; int len, max_packet_size;
uint8_t *p; uint8_t *p;
const int max_frames_per_packet = s->max_frames_per_packet ? s->max_frames_per_packet : 5; const int max_au_headers_size = 2 + 2 * s->max_frames_per_packet;
const int max_au_headers_size = 2 + 2 * max_frames_per_packet;
/* skip ADTS header, if present */ /* skip ADTS header, if present */
if ((s1->streams[0]->codec->extradata_size) == 0) { if ((s1->streams[0]->codec->extradata_size) == 0) {
...@@ -39,7 +38,7 @@ void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size) ...@@ -39,7 +38,7 @@ void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size)
/* test if the packet must be sent */ /* test if the packet must be sent */
len = (s->buf_ptr - s->buf); len = (s->buf_ptr - s->buf);
if ((s->num_frames == max_frames_per_packet) || (s->num_frames && (len + size) > s->max_payload_size)) { if ((s->num_frames == s->max_frames_per_packet) || (s->num_frames && (len + size) > s->max_payload_size)) {
int au_size = s->num_frames * 2; int au_size = s->num_frames * 2;
p = s->buf + max_au_headers_size - au_size - 2; p = s->buf + max_au_headers_size - au_size - 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment