rtmp: update timestamp after complete packet (#172)

if the RTMP packet received is not complete, the dechunker
will decode the RTMP header and then return (wait for more data).

currently it erroneously also updates the timestamp from the delta,
even if the packet is incomplete. this means that the timestamp
will be updated twice, which is not correct.

a suggested fix is to move the timestamp calculation to after the
complete packet has been read.
This commit is contained in:
Alfred E. Heggestad 2018-11-30 09:42:43 +01:00 committed by Richard Aas
parent f8717d8247
commit c8473536fd

View file

@ -158,13 +158,10 @@ int rtmp_dechunker_receive(struct rtmp_dechunker *rd, struct mbuf *mb)
chunk->hdr.timestamp_delta = hdr.timestamp_delta;
chunk->hdr.length = hdr.length;
chunk->hdr.type_id = hdr.type_id;
chunk->hdr.timestamp += hdr.timestamp_delta;
}
else if (hdr.format == 2) {
chunk->hdr.timestamp_delta = hdr.timestamp_delta;
chunk->hdr.timestamp += hdr.timestamp_delta;
}
msg_len = chunk->hdr.length;
@ -187,6 +184,9 @@ int rtmp_dechunker_receive(struct rtmp_dechunker *rd, struct mbuf *mb)
chunk->mb->end = chunk_sz;
chunk->hdr.format = hdr.format;
if (hdr.format == 1 || hdr.format == 2)
chunk->hdr.timestamp += hdr.timestamp_delta;
break;
case 3: