avformat/rtmpproto: Added handling of an initial RTMP chunk size packet.
Fixes ticket #2911.
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 36b9c27dae
)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
committed by
Michael Niedermayer
parent
fa16440659
commit
e3b08b3ad4
@@ -150,6 +150,8 @@ static const uint8_t rtmp_server_key[] = {
|
|||||||
0xE6, 0x36, 0xCF, 0xEB, 0x31, 0xAE
|
0xE6, 0x36, 0xCF, 0xEB, 0x31, 0xAE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int handle_chunk_size(URLContext *s, RTMPPacket *pkt);
|
||||||
|
|
||||||
static int add_tracked_method(RTMPContext *rt, const char *name, int id)
|
static int add_tracked_method(RTMPContext *rt, const char *name, int id)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
@@ -408,6 +410,17 @@ static int read_connect(URLContext *s, RTMPContext *rt)
|
|||||||
if ((ret = ff_rtmp_packet_read(rt->stream, &pkt, rt->in_chunk_size,
|
if ((ret = ff_rtmp_packet_read(rt->stream, &pkt, rt->in_chunk_size,
|
||||||
&rt->prev_pkt[0], &rt->nb_prev_pkt[0])) < 0)
|
&rt->prev_pkt[0], &rt->nb_prev_pkt[0])) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if (pkt.type == RTMP_PT_CHUNK_SIZE) {
|
||||||
|
if ((ret = handle_chunk_size(s, &pkt)) < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ff_rtmp_packet_destroy(&pkt);
|
||||||
|
if ((ret = ff_rtmp_packet_read(rt->stream, &pkt, rt->in_chunk_size,
|
||||||
|
&rt->prev_pkt[0], &rt->nb_prev_pkt[0])) < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
cp = pkt.data;
|
cp = pkt.data;
|
||||||
bytestream2_init(&gbc, cp, pkt.size);
|
bytestream2_init(&gbc, cp, pkt.size);
|
||||||
if (ff_amf_read_string(&gbc, command, sizeof(command), &stringlen)) {
|
if (ff_amf_read_string(&gbc, command, sizeof(command), &stringlen)) {
|
||||||
|
Reference in New Issue
Block a user