Merge remote-tracking branch 'qatar/master'

* qatar/master:
  movenc: Don't write the 'wave' atom or its child 'enda' for lpcm audio.
  imc: some cosmetics
  rtmp: Pass the proper return code in rtmp_handshake
  rtmp: Check return codes of net IO operations

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2012-05-25 20:48:50 +02:00
4 changed files with 281 additions and 221 deletions

View File

@@ -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++;
}
}