|
|
|
@ -651,6 +651,10 @@ static int get_packet(URLContext *s, int for_header) |
|
|
|
|
{ |
|
|
|
|
RTMPContext *rt = s->priv_data; |
|
|
|
|
int ret; |
|
|
|
|
uint8_t *p; |
|
|
|
|
const uint8_t *next; |
|
|
|
|
uint32_t data_size; |
|
|
|
|
uint32_t ts, cts, pts=0; |
|
|
|
|
|
|
|
|
|
if (rt->state == STATE_STOPPED) |
|
|
|
|
return AVERROR_EOF; |
|
|
|
@ -685,8 +689,7 @@ static int get_packet(URLContext *s, int for_header) |
|
|
|
|
} |
|
|
|
|
if (rpkt.type == RTMP_PT_VIDEO || rpkt.type == RTMP_PT_AUDIO || |
|
|
|
|
(rpkt.type == RTMP_PT_NOTIFY && !memcmp("\002\000\012onMetaData", rpkt.data, 13))) { |
|
|
|
|
uint8_t *p; |
|
|
|
|
uint32_t ts = rpkt.timestamp; |
|
|
|
|
ts = rpkt.timestamp; |
|
|
|
|
|
|
|
|
|
// generate packet header and put data into buffer for FLV demuxer
|
|
|
|
|
rt->flv_off = 0; |
|
|
|
@ -706,6 +709,23 @@ static int get_packet(URLContext *s, int for_header) |
|
|
|
|
rt->flv_off = 0; |
|
|
|
|
rt->flv_size = rpkt.data_size; |
|
|
|
|
rt->flv_data = av_realloc(rt->flv_data, rt->flv_size); |
|
|
|
|
/* rewrite timestamps */ |
|
|
|
|
next = rpkt.data; |
|
|
|
|
ts = rpkt.timestamp; |
|
|
|
|
while (next - rpkt.data < rpkt.data_size - 11) { |
|
|
|
|
next++; |
|
|
|
|
data_size = bytestream_get_be24(&next); |
|
|
|
|
p=next; |
|
|
|
|
cts = bytestream_get_be24(&next); |
|
|
|
|
cts |= bytestream_get_byte(&next); |
|
|
|
|
if (pts==0) |
|
|
|
|
pts=cts; |
|
|
|
|
ts += cts - pts; |
|
|
|
|
pts = cts; |
|
|
|
|
bytestream_put_be24(&p, ts); |
|
|
|
|
bytestream_put_byte(&p, ts >> 24); |
|
|
|
|
next += data_size + 3 + 4; |
|
|
|
|
} |
|
|
|
|
memcpy(rt->flv_data, rpkt.data, rpkt.data_size); |
|
|
|
|
ff_rtmp_packet_destroy(&rpkt); |
|
|
|
|
return 0; |
|
|
|
|