diff options
author | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2012-05-24 13:48:25 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-05-24 22:16:46 +0300 |
commit | bba287fdac98362e94f386159912046b8b1a65fc (patch) | |
tree | d74240e231f7deb9582852afd1b2be5f2eaf5eb0 /libavformat/rtmppkt.c | |
parent | a4d3f3580bd993f4e8f4abc9c4ad486cb1c51987 (diff) | |
download | ffmpeg-bba287fdac98362e94f386159912046b8b1a65fc.tar.gz |
rtmp: Check return codes of net IO operations
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtmppkt.c')
-rw-r--r-- | libavformat/rtmppkt.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c index 474f637c2b..ed8e6b203d 100644 --- a/libavformat/rtmppkt.c +++ b/libavformat/rtmppkt.c @@ -151,7 +151,10 @@ int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p, offset += chunk_size; size += chunk_size; if (data_size > 0) { - ffurl_read_complete(h, &t, 1); //marker + if ((ret = ffurl_read_complete(h, &t, 1)) < 0) { // marker + ff_rtmp_packet_destroy(p); + return ret; + } size++; if (t != (0xC0 + channel_id)) return -1; @@ -167,6 +170,7 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt, int mode = RTMP_PS_TWELVEBYTES; int off = 0; int size = 0; + int ret; pkt->ts_delta = pkt->timestamp - prev_pkt[pkt->channel_id].timestamp; @@ -218,15 +222,18 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt, } prev_pkt[pkt->channel_id].extra = pkt->extra; - ffurl_write(h, pkt_hdr, p-pkt_hdr); + if ((ret = ffurl_write(h, pkt_hdr, p - pkt_hdr)) < 0) + return ret; size = p - pkt_hdr + pkt->data_size; while (off < pkt->data_size) { int towrite = FFMIN(chunk_size, pkt->data_size - off); - ffurl_write(h, pkt->data + off, towrite); + if ((ret = ffurl_write(h, pkt->data + off, towrite)) < 0) + return ret; off += towrite; if (off < pkt->data_size) { uint8_t marker = 0xC0 | pkt->channel_id; - ffurl_write(h, &marker, 1); + if ((ret = ffurl_write(h, &marker, 1)) < 0) + return ret; size++; } } |