Skip to content

Commit

Permalink
Merge commit 'bde2bba45c2f2df27a8534028bda09a6e7f835e2'
Browse files Browse the repository at this point in the history
* commit 'bde2bba45c2f2df27a8534028bda09a6e7f835e2':
  rtpenc: Restructure if statements in packetizers to simplify adding more conditions

Conflicts:
	libavformat/rtpenc_xiph.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
  • Loading branch information
michaelni committed Mar 1, 2015
2 parents 769b473 + bde2bba commit 78c59f3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion libavformat/rtpenc_aac.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ 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->num_frames == s->max_frames_per_packet) || (s->num_frames && (len + size) > s->max_payload_size)) {
if (s->num_frames &&
(s->num_frames == s->max_frames_per_packet ||
(len + size) > s->max_payload_size)) {
int au_size = s->num_frames * 2;

p = s->buf + max_au_headers_size - au_size - 2;
Expand Down
4 changes: 3 additions & 1 deletion libavformat/rtpenc_amr.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ void ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size)

/* Test if the packet must be sent. */
len = s->buf_ptr - s->buf;
if (s->num_frames == s->max_frames_per_packet || (s->num_frames && len + size - 1 > s->max_payload_size)) {
if (s->num_frames &&
(s->num_frames == s->max_frames_per_packet ||
len + size - 1 > s->max_payload_size)) {
int header_size = s->num_frames + 1;
p = s->buf + max_header_toc_size - header_size;
if (p != s->buf)
Expand Down
5 changes: 3 additions & 2 deletions libavformat/rtpenc_xiph.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ void ff_rtp_send_xiph(AVFormatContext *s1, const uint8_t *buff, int size)
int remaining = end_ptr - ptr;

av_assert1(s->num_frames <= s->max_frames_per_packet);
if ((s->num_frames > 0 && remaining < 0) ||
s->num_frames == s->max_frames_per_packet) {
if (s->num_frames > 0 &&
(remaining < 0 ||
s->num_frames == s->max_frames_per_packet)) {
// send previous packets now; no room for new data
ff_rtp_send_data(s1, s->buf, s->buf_ptr - s->buf, 0);
s->num_frames = 0;
Expand Down

0 comments on commit 78c59f3

Please sign in to comment.