rtpenc: Restructure if statements in packetizers to simplify adding more conditions

Factorize out the s->num_frames check at the start of the if statements,
simplifying adding more alternative causes for sending the buffered
frames.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö
2015-02-27 12:32:42 +02:00
parent d4c7fc02f9
commit bde2bba45c
3 changed files with 9 additions and 4 deletions

View File

@@ -75,8 +75,9 @@ void ff_rtp_send_xiph(AVFormatContext *s1, const uint8_t *buff, int size)
int remaining = end_ptr - ptr;
assert(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;