mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge remote-tracking branch 'qatar/master'
* qatar/master: rtmppkt: Rename the ts_delta field to ts_field Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
4fc339faea
@ -196,7 +196,7 @@ static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p,
|
|||||||
|
|
||||||
hdr >>= 6; // header size indicator
|
hdr >>= 6; // header size indicator
|
||||||
if (hdr == RTMP_PS_ONEBYTE) {
|
if (hdr == RTMP_PS_ONEBYTE) {
|
||||||
ts_field = prev_pkt[channel_id].ts_delta;
|
ts_field = prev_pkt[channel_id].ts_field;
|
||||||
} else {
|
} else {
|
||||||
if (ffurl_read_complete(h, buf, 3) != 3)
|
if (ffurl_read_complete(h, buf, 3) != 3)
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
@ -235,7 +235,7 @@ static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p,
|
|||||||
return ret;
|
return ret;
|
||||||
p->read = written;
|
p->read = written;
|
||||||
p->offset = 0;
|
p->offset = 0;
|
||||||
prev_pkt[channel_id].ts_delta = ts_field;
|
prev_pkt[channel_id].ts_field = ts_field;
|
||||||
prev_pkt[channel_id].timestamp = timestamp;
|
prev_pkt[channel_id].timestamp = timestamp;
|
||||||
} else {
|
} else {
|
||||||
// previous packet in this channel hasn't completed reading
|
// previous packet in this channel hasn't completed reading
|
||||||
@ -244,7 +244,7 @@ static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p,
|
|||||||
p->size = prev->size;
|
p->size = prev->size;
|
||||||
p->channel_id = prev->channel_id;
|
p->channel_id = prev->channel_id;
|
||||||
p->type = prev->type;
|
p->type = prev->type;
|
||||||
p->ts_delta = prev->ts_delta;
|
p->ts_field = prev->ts_field;
|
||||||
p->extra = prev->extra;
|
p->extra = prev->extra;
|
||||||
p->offset = prev->offset;
|
p->offset = prev->offset;
|
||||||
p->read = prev->read + written;
|
p->read = prev->read + written;
|
||||||
@ -323,16 +323,16 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
|
|||||||
timestamp -= prev_pkt[pkt->channel_id].timestamp;
|
timestamp -= prev_pkt[pkt->channel_id].timestamp;
|
||||||
}
|
}
|
||||||
if (timestamp >= 0xFFFFFF) {
|
if (timestamp >= 0xFFFFFF) {
|
||||||
pkt->ts_delta = 0xFFFFFF;
|
pkt->ts_field = 0xFFFFFF;
|
||||||
} else {
|
} else {
|
||||||
pkt->ts_delta = timestamp;
|
pkt->ts_field = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_delta) {
|
if (use_delta) {
|
||||||
if (pkt->type == prev_pkt[pkt->channel_id].type &&
|
if (pkt->type == prev_pkt[pkt->channel_id].type &&
|
||||||
pkt->size == prev_pkt[pkt->channel_id].size) {
|
pkt->size == prev_pkt[pkt->channel_id].size) {
|
||||||
mode = RTMP_PS_FOURBYTES;
|
mode = RTMP_PS_FOURBYTES;
|
||||||
if (pkt->ts_delta == prev_pkt[pkt->channel_id].ts_delta)
|
if (pkt->ts_field == prev_pkt[pkt->channel_id].ts_field)
|
||||||
mode = RTMP_PS_ONEBYTE;
|
mode = RTMP_PS_ONEBYTE;
|
||||||
} else {
|
} else {
|
||||||
mode = RTMP_PS_EIGHTBYTES;
|
mode = RTMP_PS_EIGHTBYTES;
|
||||||
@ -349,7 +349,7 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
|
|||||||
bytestream_put_le16(&p, pkt->channel_id - 64);
|
bytestream_put_le16(&p, pkt->channel_id - 64);
|
||||||
}
|
}
|
||||||
if (mode != RTMP_PS_ONEBYTE) {
|
if (mode != RTMP_PS_ONEBYTE) {
|
||||||
bytestream_put_be24(&p, pkt->ts_delta);
|
bytestream_put_be24(&p, pkt->ts_field);
|
||||||
if (mode != RTMP_PS_FOURBYTES) {
|
if (mode != RTMP_PS_FOURBYTES) {
|
||||||
bytestream_put_be24(&p, pkt->size);
|
bytestream_put_be24(&p, pkt->size);
|
||||||
bytestream_put_byte(&p, pkt->type);
|
bytestream_put_byte(&p, pkt->type);
|
||||||
@ -357,14 +357,14 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
|
|||||||
bytestream_put_le32(&p, pkt->extra);
|
bytestream_put_le32(&p, pkt->extra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pkt->ts_delta == 0xFFFFFF)
|
if (pkt->ts_field == 0xFFFFFF)
|
||||||
bytestream_put_be32(&p, timestamp);
|
bytestream_put_be32(&p, timestamp);
|
||||||
// save history
|
// save history
|
||||||
prev_pkt[pkt->channel_id].channel_id = pkt->channel_id;
|
prev_pkt[pkt->channel_id].channel_id = pkt->channel_id;
|
||||||
prev_pkt[pkt->channel_id].type = pkt->type;
|
prev_pkt[pkt->channel_id].type = pkt->type;
|
||||||
prev_pkt[pkt->channel_id].size = pkt->size;
|
prev_pkt[pkt->channel_id].size = pkt->size;
|
||||||
prev_pkt[pkt->channel_id].timestamp = pkt->timestamp;
|
prev_pkt[pkt->channel_id].timestamp = pkt->timestamp;
|
||||||
prev_pkt[pkt->channel_id].ts_delta = pkt->ts_delta;
|
prev_pkt[pkt->channel_id].ts_field = pkt->ts_field;
|
||||||
prev_pkt[pkt->channel_id].extra = pkt->extra;
|
prev_pkt[pkt->channel_id].extra = pkt->extra;
|
||||||
|
|
||||||
if ((ret = ffurl_write(h, pkt_hdr, p - pkt_hdr)) < 0)
|
if ((ret = ffurl_write(h, pkt_hdr, p - pkt_hdr)) < 0)
|
||||||
@ -398,7 +398,7 @@ int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
|
|||||||
pkt->type = type;
|
pkt->type = type;
|
||||||
pkt->timestamp = timestamp;
|
pkt->timestamp = timestamp;
|
||||||
pkt->extra = 0;
|
pkt->extra = 0;
|
||||||
pkt->ts_delta = 0;
|
pkt->ts_field = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ typedef struct RTMPPacket {
|
|||||||
int channel_id; ///< RTMP channel ID (nothing to do with audio/video channels though)
|
int channel_id; ///< RTMP channel ID (nothing to do with audio/video channels though)
|
||||||
RTMPPacketType type; ///< packet payload type
|
RTMPPacketType type; ///< packet payload type
|
||||||
uint32_t timestamp; ///< packet full timestamp
|
uint32_t timestamp; ///< packet full timestamp
|
||||||
uint32_t ts_delta; ///< 24-bit timestamp or increment to the previous one, in milliseconds (latter only for media packets). Clipped to a maximum of 0xFFFFFF, indicating an extended timestamp field.
|
uint32_t ts_field; ///< 24-bit timestamp or increment to the previous one, in milliseconds (latter only for media packets). Clipped to a maximum of 0xFFFFFF, indicating an extended timestamp field.
|
||||||
uint32_t extra; ///< probably an additional channel ID used during streaming data
|
uint32_t extra; ///< probably an additional channel ID used during streaming data
|
||||||
uint8_t *data; ///< packet payload
|
uint8_t *data; ///< packet payload
|
||||||
int size; ///< packet payload size
|
int size; ///< packet payload size
|
||||||
|
Loading…
Reference in New Issue
Block a user