Skip to content

Commit

Permalink
Merge commit '22cc57da64bfd73f2206969486b0aa183ee76479'
Browse files Browse the repository at this point in the history
* commit '22cc57da64bfd73f2206969486b0aa183ee76479':
  rtpdec: Forward the memory failure

Merged-by: Hendrik Leppkes <[email protected]>
  • Loading branch information
Nevcairiel committed Sep 17, 2015
2 parents d36eac6 + 22cc57d commit 1579693
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions libavformat/rtpdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ void ff_rtp_reset_packet_queue(RTPDemuxContext *s)
s->prev_ret = 0;
}

static void enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len)
static int enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len)
{
uint16_t seq = AV_RB16(buf + 2);
RTPPacket **cur = &s->queue, *packet;
Expand All @@ -706,14 +706,16 @@ static void enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len)

packet = av_mallocz(sizeof(*packet));
if (!packet)
return;
return AVERROR(ENOMEM);
packet->recvtime = av_gettime_relative();
packet->seq = seq;
packet->len = len;
packet->buf = buf;
packet->next = *cur;
*cur = packet;
s->queue_len++;

return 0;
}

static int has_next_packet(RTPDemuxContext *s)
Expand Down Expand Up @@ -811,7 +813,9 @@ static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt,
return rv;
} else {
/* Still missing some packet, enqueue this one. */
enqueue_packet(s, buf, len);
rv = enqueue_packet(s, buf, len);
if (rv < 0)
return rv;
*bufptr = NULL;
/* Return the first enqueued packet if the queue is full,
* even if we're missing something */
Expand Down

0 comments on commit 1579693

Please sign in to comment.