mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-09-02 06:23:23 +02:00
Merge commit 'ba5393a609c723ec8ab7f9727c10fef734c09278'
* commit 'ba5393a609c723ec8ab7f9727c10fef734c09278': rtmp: rename data_size to size Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
06186a3160
@ -145,25 +145,25 @@ int ff_rtmp_packet_read_internal(URLContext *h, RTMPPacket *p, int chunk_size,
|
||||
{
|
||||
|
||||
uint8_t t, buf[16];
|
||||
int channel_id, timestamp, data_size, offset = 0;
|
||||
int channel_id, timestamp, size, offset = 0;
|
||||
uint32_t extra = 0;
|
||||
enum RTMPPacketType type;
|
||||
int size = 0;
|
||||
int written = 0;
|
||||
int ret;
|
||||
|
||||
size++;
|
||||
written++;
|
||||
channel_id = hdr & 0x3F;
|
||||
|
||||
if (channel_id < 2) { //special case for channel number >= 64
|
||||
buf[1] = 0;
|
||||
if (ffurl_read_complete(h, buf, channel_id + 1) != channel_id + 1)
|
||||
return AVERROR(EIO);
|
||||
size += channel_id + 1;
|
||||
written += channel_id + 1;
|
||||
channel_id = AV_RL16(buf) + 64;
|
||||
}
|
||||
data_size = prev_pkt[channel_id].data_size;
|
||||
type = prev_pkt[channel_id].type;
|
||||
extra = prev_pkt[channel_id].extra;
|
||||
size = prev_pkt[channel_id].size;
|
||||
type = prev_pkt[channel_id].type;
|
||||
extra = prev_pkt[channel_id].extra;
|
||||
|
||||
hdr >>= 6;
|
||||
if (hdr == RTMP_PS_ONEBYTE) {
|
||||
@ -171,21 +171,21 @@ int ff_rtmp_packet_read_internal(URLContext *h, RTMPPacket *p, int chunk_size,
|
||||
} else {
|
||||
if (ffurl_read_complete(h, buf, 3) != 3)
|
||||
return AVERROR(EIO);
|
||||
size += 3;
|
||||
written += 3;
|
||||
timestamp = AV_RB24(buf);
|
||||
if (hdr != RTMP_PS_FOURBYTES) {
|
||||
if (ffurl_read_complete(h, buf, 3) != 3)
|
||||
return AVERROR(EIO);
|
||||
size += 3;
|
||||
data_size = AV_RB24(buf);
|
||||
written += 3;
|
||||
size = AV_RB24(buf);
|
||||
if (ffurl_read_complete(h, buf, 1) != 1)
|
||||
return AVERROR(EIO);
|
||||
size++;
|
||||
written++;
|
||||
type = buf[0];
|
||||
if (hdr == RTMP_PS_TWELVEBYTES) {
|
||||
if (ffurl_read_complete(h, buf, 4) != 4)
|
||||
return AVERROR(EIO);
|
||||
size += 4;
|
||||
written += 4;
|
||||
extra = AV_RL32(buf);
|
||||
}
|
||||
}
|
||||
@ -199,36 +199,36 @@ int ff_rtmp_packet_read_internal(URLContext *h, RTMPPacket *p, int chunk_size,
|
||||
timestamp += prev_pkt[channel_id].timestamp;
|
||||
|
||||
if ((ret = ff_rtmp_packet_create(p, channel_id, type, timestamp,
|
||||
data_size)) < 0)
|
||||
size)) < 0)
|
||||
return ret;
|
||||
p->extra = extra;
|
||||
// save history
|
||||
prev_pkt[channel_id].channel_id = channel_id;
|
||||
prev_pkt[channel_id].type = type;
|
||||
prev_pkt[channel_id].data_size = data_size;
|
||||
prev_pkt[channel_id].size = size;
|
||||
prev_pkt[channel_id].ts_delta = timestamp - prev_pkt[channel_id].timestamp;
|
||||
prev_pkt[channel_id].timestamp = timestamp;
|
||||
prev_pkt[channel_id].extra = extra;
|
||||
while (data_size > 0) {
|
||||
int toread = FFMIN(data_size, chunk_size);
|
||||
while (size > 0) {
|
||||
int toread = FFMIN(size, chunk_size);
|
||||
if (ffurl_read_complete(h, p->data + offset, toread) != toread) {
|
||||
ff_rtmp_packet_destroy(p);
|
||||
return AVERROR(EIO);
|
||||
}
|
||||
data_size -= chunk_size;
|
||||
offset += chunk_size;
|
||||
size += chunk_size;
|
||||
if (data_size > 0) {
|
||||
size -= chunk_size;
|
||||
offset += chunk_size;
|
||||
written += chunk_size;
|
||||
if (size > 0) {
|
||||
if ((ret = ffurl_read_complete(h, &t, 1)) < 0) { // marker
|
||||
ff_rtmp_packet_destroy(p);
|
||||
return ret;
|
||||
}
|
||||
size++;
|
||||
written++;
|
||||
if (t != (0xC0 + channel_id))
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return size;
|
||||
return written;
|
||||
}
|
||||
|
||||
int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
|
||||
@ -237,7 +237,7 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
|
||||
uint8_t pkt_hdr[16], *p = pkt_hdr;
|
||||
int mode = RTMP_PS_TWELVEBYTES;
|
||||
int off = 0;
|
||||
int size = 0;
|
||||
int written = 0;
|
||||
int ret;
|
||||
|
||||
pkt->ts_delta = pkt->timestamp - prev_pkt[pkt->channel_id].timestamp;
|
||||
@ -246,7 +246,7 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
|
||||
if (prev_pkt[pkt->channel_id].channel_id &&
|
||||
pkt->extra == prev_pkt[pkt->channel_id].extra) {
|
||||
if (pkt->type == prev_pkt[pkt->channel_id].type &&
|
||||
pkt->data_size == prev_pkt[pkt->channel_id].data_size) {
|
||||
pkt->size == prev_pkt[pkt->channel_id].size) {
|
||||
mode = RTMP_PS_FOURBYTES;
|
||||
if (pkt->ts_delta == prev_pkt[pkt->channel_id].ts_delta)
|
||||
mode = RTMP_PS_ONEBYTE;
|
||||
@ -270,7 +270,7 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
|
||||
timestamp = pkt->ts_delta;
|
||||
bytestream_put_be24(&p, timestamp >= 0xFFFFFF ? 0xFFFFFF : timestamp);
|
||||
if (mode != RTMP_PS_FOURBYTES) {
|
||||
bytestream_put_be24(&p, pkt->data_size);
|
||||
bytestream_put_be24(&p, pkt->size);
|
||||
bytestream_put_byte(&p, pkt->type);
|
||||
if (mode == RTMP_PS_TWELVEBYTES)
|
||||
bytestream_put_le32(&p, pkt->extra);
|
||||
@ -281,7 +281,7 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
|
||||
// save history
|
||||
prev_pkt[pkt->channel_id].channel_id = pkt->channel_id;
|
||||
prev_pkt[pkt->channel_id].type = pkt->type;
|
||||
prev_pkt[pkt->channel_id].data_size = pkt->data_size;
|
||||
prev_pkt[pkt->channel_id].size = pkt->size;
|
||||
prev_pkt[pkt->channel_id].timestamp = pkt->timestamp;
|
||||
if (mode != RTMP_PS_TWELVEBYTES) {
|
||||
prev_pkt[pkt->channel_id].ts_delta = pkt->ts_delta;
|
||||
@ -292,20 +292,20 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
|
||||
|
||||
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);
|
||||
written = p - pkt_hdr + pkt->size;
|
||||
while (off < pkt->size) {
|
||||
int towrite = FFMIN(chunk_size, pkt->size - off);
|
||||
if ((ret = ffurl_write(h, pkt->data + off, towrite)) < 0)
|
||||
return ret;
|
||||
off += towrite;
|
||||
if (off < pkt->data_size) {
|
||||
if (off < pkt->size) {
|
||||
uint8_t marker = 0xC0 | pkt->channel_id;
|
||||
if ((ret = ffurl_write(h, &marker, 1)) < 0)
|
||||
return ret;
|
||||
size++;
|
||||
written++;
|
||||
}
|
||||
}
|
||||
return size;
|
||||
return written;
|
||||
}
|
||||
|
||||
int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
|
||||
@ -316,7 +316,7 @@ int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
|
||||
if (!pkt->data)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
pkt->data_size = size;
|
||||
pkt->size = size;
|
||||
pkt->channel_id = channel_id;
|
||||
pkt->type = type;
|
||||
pkt->timestamp = timestamp;
|
||||
@ -331,7 +331,7 @@ void ff_rtmp_packet_destroy(RTMPPacket *pkt)
|
||||
if (!pkt)
|
||||
return;
|
||||
av_freep(&pkt->data);
|
||||
pkt->data_size = 0;
|
||||
pkt->size = 0;
|
||||
}
|
||||
|
||||
int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end)
|
||||
@ -503,9 +503,9 @@ static void amf_tag_contents(void *ctx, const uint8_t *data,
|
||||
void ff_rtmp_packet_dump(void *ctx, RTMPPacket *p)
|
||||
{
|
||||
av_log(ctx, AV_LOG_DEBUG, "RTMP packet type '%s'(%d) for channel %d, timestamp %d, extra field %d size %d\n",
|
||||
rtmp_packet_type(p->type), p->type, p->channel_id, p->timestamp, p->extra, p->data_size);
|
||||
rtmp_packet_type(p->type), p->type, p->channel_id, p->timestamp, p->extra, p->size);
|
||||
if (p->type == RTMP_PT_INVOKE || p->type == RTMP_PT_NOTIFY) {
|
||||
uint8_t *src = p->data, *src_end = p->data + p->data_size;
|
||||
uint8_t *src = p->data, *src_end = p->data + p->size;
|
||||
while (src < src_end) {
|
||||
int sz;
|
||||
amf_tag_contents(ctx, src, src_end);
|
||||
@ -520,7 +520,7 @@ void ff_rtmp_packet_dump(void *ctx, RTMPPacket *p)
|
||||
av_log(ctx, AV_LOG_DEBUG, "Client BW = %d\n", AV_RB32(p->data));
|
||||
} else if (p->type != RTMP_PT_AUDIO && p->type != RTMP_PT_VIDEO && p->type != RTMP_PT_METADATA) {
|
||||
int i;
|
||||
for (i = 0; i < p->data_size; i++)
|
||||
for (i = 0; i < p->size; i++)
|
||||
av_log(ctx, AV_LOG_DEBUG, " %02X", p->data[i]);
|
||||
av_log(ctx, AV_LOG_DEBUG, "\n");
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ typedef struct RTMPPacket {
|
||||
uint32_t ts_delta; ///< timestamp increment to the previous one in milliseconds (latter only for media packets)
|
||||
uint32_t extra; ///< probably an additional channel ID used during streaming data
|
||||
uint8_t *data; ///< packet payload
|
||||
int data_size; ///< packet payload size
|
||||
int size; ///< packet payload size
|
||||
} RTMPPacket;
|
||||
|
||||
/**
|
||||
|
@ -185,7 +185,7 @@ static int find_tracked_method(URLContext *s, RTMPPacket *pkt, int offset,
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
bytestream2_init(&gbc, pkt->data + offset, pkt->data_size - offset);
|
||||
bytestream2_init(&gbc, pkt->data + offset, pkt->size - offset);
|
||||
if ((ret = ff_amf_read_number(&gbc, &pkt_id)) < 0)
|
||||
return ret;
|
||||
|
||||
@ -223,7 +223,7 @@ static int rtmp_send_packet(RTMPContext *rt, RTMPPacket *pkt, int track)
|
||||
double pkt_id;
|
||||
int len;
|
||||
|
||||
bytestream2_init(&gbc, pkt->data, pkt->data_size);
|
||||
bytestream2_init(&gbc, pkt->data, pkt->size);
|
||||
if ((ret = ff_amf_read_string(&gbc, name, sizeof(name), &len)) < 0)
|
||||
goto fail;
|
||||
|
||||
@ -384,7 +384,7 @@ static int gen_connect(URLContext *s, RTMPContext *rt)
|
||||
}
|
||||
}
|
||||
|
||||
pkt.data_size = p - pkt.data;
|
||||
pkt.size = p - pkt.data;
|
||||
|
||||
return rtmp_send_packet(rt, &pkt, 1);
|
||||
}
|
||||
@ -405,7 +405,7 @@ static int read_connect(URLContext *s, RTMPContext *rt)
|
||||
rt->prev_pkt[1])) < 0)
|
||||
return ret;
|
||||
cp = pkt.data;
|
||||
bytestream2_init(&gbc, cp, pkt.data_size);
|
||||
bytestream2_init(&gbc, cp, pkt.size);
|
||||
if (ff_amf_read_string(&gbc, command, sizeof(command), &stringlen)) {
|
||||
av_log(s, AV_LOG_ERROR, "Unable to read command string\n");
|
||||
ff_rtmp_packet_destroy(&pkt);
|
||||
@ -436,7 +436,7 @@ static int read_connect(URLContext *s, RTMPContext *rt)
|
||||
return ret;
|
||||
p = pkt.data;
|
||||
bytestream_put_be32(&p, rt->server_bw);
|
||||
pkt.data_size = p - pkt.data;
|
||||
pkt.size = p - pkt.data;
|
||||
ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->out_chunk_size,
|
||||
rt->prev_pkt[1]);
|
||||
ff_rtmp_packet_destroy(&pkt);
|
||||
@ -449,7 +449,7 @@ static int read_connect(URLContext *s, RTMPContext *rt)
|
||||
p = pkt.data;
|
||||
bytestream_put_be32(&p, rt->server_bw);
|
||||
bytestream_put_byte(&p, 2); // dynamic
|
||||
pkt.data_size = p - pkt.data;
|
||||
pkt.size = p - pkt.data;
|
||||
ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->out_chunk_size,
|
||||
rt->prev_pkt[1]);
|
||||
ff_rtmp_packet_destroy(&pkt);
|
||||
@ -511,7 +511,7 @@ static int read_connect(URLContext *s, RTMPContext *rt)
|
||||
ff_amf_write_number(&p, 0);
|
||||
ff_amf_write_object_end(&p);
|
||||
|
||||
pkt.data_size = p - pkt.data;
|
||||
pkt.size = p - pkt.data;
|
||||
ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->out_chunk_size,
|
||||
rt->prev_pkt[1]);
|
||||
ff_rtmp_packet_destroy(&pkt);
|
||||
@ -526,7 +526,7 @@ static int read_connect(URLContext *s, RTMPContext *rt)
|
||||
ff_amf_write_number(&p, 0);
|
||||
ff_amf_write_null(&p);
|
||||
ff_amf_write_number(&p, 8192);
|
||||
pkt.data_size = p - pkt.data;
|
||||
pkt.size = p - pkt.data;
|
||||
ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->out_chunk_size,
|
||||
rt->prev_pkt[1]);
|
||||
ff_rtmp_packet_destroy(&pkt);
|
||||
@ -764,9 +764,9 @@ static int gen_pong(URLContext *s, RTMPContext *rt, RTMPPacket *ppkt)
|
||||
uint8_t *p;
|
||||
int ret;
|
||||
|
||||
if (ppkt->data_size < 6) {
|
||||
if (ppkt->size < 6) {
|
||||
av_log(s, AV_LOG_ERROR, "Too short ping packet (%d)\n",
|
||||
ppkt->data_size);
|
||||
ppkt->size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@ -1440,10 +1440,10 @@ static int handle_chunk_size(URLContext *s, RTMPPacket *pkt)
|
||||
RTMPContext *rt = s->priv_data;
|
||||
int ret;
|
||||
|
||||
if (pkt->data_size < 4) {
|
||||
if (pkt->size < 4) {
|
||||
av_log(s, AV_LOG_ERROR,
|
||||
"Too short chunk size change packet (%d)\n",
|
||||
pkt->data_size);
|
||||
pkt->size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@ -1473,9 +1473,9 @@ static int handle_ping(URLContext *s, RTMPPacket *pkt)
|
||||
RTMPContext *rt = s->priv_data;
|
||||
int t, ret;
|
||||
|
||||
if (pkt->data_size < 2) {
|
||||
if (pkt->size < 2) {
|
||||
av_log(s, AV_LOG_ERROR, "Too short ping packet (%d)\n",
|
||||
pkt->data_size);
|
||||
pkt->size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@ -1499,10 +1499,10 @@ static int handle_client_bw(URLContext *s, RTMPPacket *pkt)
|
||||
{
|
||||
RTMPContext *rt = s->priv_data;
|
||||
|
||||
if (pkt->data_size < 4) {
|
||||
if (pkt->size < 4) {
|
||||
av_log(s, AV_LOG_ERROR,
|
||||
"Client bandwidth report packet is less than 4 bytes long (%d)\n",
|
||||
pkt->data_size);
|
||||
pkt->size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@ -1523,10 +1523,10 @@ static int handle_server_bw(URLContext *s, RTMPPacket *pkt)
|
||||
{
|
||||
RTMPContext *rt = s->priv_data;
|
||||
|
||||
if (pkt->data_size < 4) {
|
||||
if (pkt->size < 4) {
|
||||
av_log(s, AV_LOG_ERROR,
|
||||
"Too short server bandwidth report packet (%d)\n",
|
||||
pkt->data_size);
|
||||
pkt->size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@ -1726,7 +1726,7 @@ static int handle_connect_error(URLContext *s, const char *desc)
|
||||
static int handle_invoke_error(URLContext *s, RTMPPacket *pkt)
|
||||
{
|
||||
RTMPContext *rt = s->priv_data;
|
||||
const uint8_t *data_end = pkt->data + pkt->data_size;
|
||||
const uint8_t *data_end = pkt->data + pkt->size;
|
||||
char *tracked_method = NULL;
|
||||
int level = AV_LOG_ERROR;
|
||||
uint8_t tmpstr[256];
|
||||
@ -1774,7 +1774,7 @@ static int send_invoke_response(URLContext *s, RTMPPacket *pkt)
|
||||
GetByteContext gbc;
|
||||
int ret;
|
||||
|
||||
bytestream2_init(&gbc, p, pkt->data_size);
|
||||
bytestream2_init(&gbc, p, pkt->size);
|
||||
if (ff_amf_read_string(&gbc, command, sizeof(command),
|
||||
&stringlen)) {
|
||||
av_log(s, AV_LOG_ERROR, "Error in PT_INVOKE\n");
|
||||
@ -1826,7 +1826,7 @@ static int send_invoke_response(URLContext *s, RTMPPacket *pkt)
|
||||
return ret;
|
||||
}
|
||||
pp = spkt.data;
|
||||
bytestream2_init_writer(&pbc, pp, spkt.data_size);
|
||||
bytestream2_init_writer(&pbc, pp, spkt.size);
|
||||
bytestream2_put_be16(&pbc, 0); // 0 -> Stream Begin
|
||||
bytestream2_put_be32(&pbc, rt->nb_streamid);
|
||||
ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size,
|
||||
@ -1885,7 +1885,7 @@ static int send_invoke_response(URLContext *s, RTMPPacket *pkt)
|
||||
* if a client creates more than 2^32 - 2 streams. */
|
||||
}
|
||||
}
|
||||
spkt.data_size = pp - spkt.data;
|
||||
spkt.size = pp - spkt.data;
|
||||
ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size,
|
||||
rt->prev_pkt[1]);
|
||||
ff_rtmp_packet_destroy(&spkt);
|
||||
@ -1959,7 +1959,7 @@ fail:
|
||||
static int handle_invoke_status(URLContext *s, RTMPPacket *pkt)
|
||||
{
|
||||
RTMPContext *rt = s->priv_data;
|
||||
const uint8_t *data_end = pkt->data + pkt->data_size;
|
||||
const uint8_t *data_end = pkt->data + pkt->size;
|
||||
const uint8_t *ptr = pkt->data + 11;
|
||||
uint8_t tmpstr[256];
|
||||
int i, t;
|
||||
@ -2034,7 +2034,7 @@ static int handle_notify(URLContext *s, RTMPPacket *pkt) {
|
||||
unsigned datatowritelength;
|
||||
|
||||
p = pkt->data;
|
||||
bytestream2_init(&gbc, p, pkt->data_size);
|
||||
bytestream2_init(&gbc, p, pkt->size);
|
||||
if (ff_amf_read_string(&gbc, commandbuffer, sizeof(commandbuffer),
|
||||
&stringlen))
|
||||
return AVERROR_INVALIDDATA;
|
||||
@ -2148,7 +2148,7 @@ static int get_packet(URLContext *s, int for_header)
|
||||
int ret;
|
||||
uint8_t *p;
|
||||
const uint8_t *next;
|
||||
uint32_t data_size;
|
||||
uint32_t size;
|
||||
uint32_t ts, cts, pts=0;
|
||||
|
||||
if (rt->state == STATE_STOPPED)
|
||||
@ -2202,7 +2202,7 @@ static int get_packet(URLContext *s, int for_header)
|
||||
ff_rtmp_packet_destroy(&rpkt);
|
||||
return 0;
|
||||
}
|
||||
if (!rpkt.data_size || !rt->is_input) {
|
||||
if (!rpkt.size || !rt->is_input) {
|
||||
ff_rtmp_packet_destroy(&rpkt);
|
||||
continue;
|
||||
}
|
||||
@ -2212,14 +2212,14 @@ static int get_packet(URLContext *s, int for_header)
|
||||
|
||||
// generate packet header and put data into buffer for FLV demuxer
|
||||
rt->flv_off = 0;
|
||||
rt->flv_size = rpkt.data_size + 15;
|
||||
rt->flv_size = rpkt.size + 15;
|
||||
rt->flv_data = p = av_realloc(rt->flv_data, rt->flv_size);
|
||||
bytestream_put_byte(&p, rpkt.type);
|
||||
bytestream_put_be24(&p, rpkt.data_size);
|
||||
bytestream_put_be24(&p, rpkt.size);
|
||||
bytestream_put_be24(&p, ts);
|
||||
bytestream_put_byte(&p, ts >> 24);
|
||||
bytestream_put_be24(&p, 0);
|
||||
bytestream_put_buffer(&p, rpkt.data, rpkt.data_size);
|
||||
bytestream_put_buffer(&p, rpkt.data, rpkt.size);
|
||||
bytestream_put_be32(&p, 0);
|
||||
ff_rtmp_packet_destroy(&rpkt);
|
||||
return 0;
|
||||
@ -2234,14 +2234,14 @@ static int get_packet(URLContext *s, int for_header)
|
||||
} else if (rpkt.type == RTMP_PT_METADATA) {
|
||||
// we got raw FLV data, make it available for FLV demuxer
|
||||
rt->flv_off = 0;
|
||||
rt->flv_size = rpkt.data_size;
|
||||
rt->flv_size = rpkt.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) {
|
||||
while (next - rpkt.data < rpkt.size - 11) {
|
||||
next++;
|
||||
data_size = bytestream_get_be24(&next);
|
||||
size = bytestream_get_be24(&next);
|
||||
p=next;
|
||||
cts = bytestream_get_be24(&next);
|
||||
cts |= bytestream_get_byte(&next) << 24;
|
||||
@ -2251,9 +2251,9 @@ static int get_packet(URLContext *s, int for_header)
|
||||
pts = cts;
|
||||
bytestream_put_be24(&p, ts);
|
||||
bytestream_put_byte(&p, ts >> 24);
|
||||
next += data_size + 3 + 4;
|
||||
next += size + 3 + 4;
|
||||
}
|
||||
memcpy(rt->flv_data, rpkt.data, rpkt.data_size);
|
||||
memcpy(rt->flv_data, rpkt.data, rpkt.size);
|
||||
ff_rtmp_packet_destroy(&rpkt);
|
||||
return 0;
|
||||
}
|
||||
@ -2268,7 +2268,7 @@ static int rtmp_close(URLContext *h)
|
||||
|
||||
if (!rt->is_input) {
|
||||
rt->flv_data = NULL;
|
||||
if (rt->out_pkt.data_size)
|
||||
if (rt->out_pkt.size)
|
||||
ff_rtmp_packet_destroy(&rt->out_pkt);
|
||||
if (rt->state > STATE_FCPUBLISH)
|
||||
ret = gen_fcunpublish_stream(h, rt);
|
||||
|
Loading…
Reference in New Issue
Block a user