aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtmpproto.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2011-12-05 12:35:06 +0200
committerMartin Storsjö <martin@martin.st>2011-12-07 09:01:55 +0200
commit1eef08f98cc2f216ecc44041ad727aaa7fa2c705 (patch)
tree8da15a8c0f8ce55881e37c9719d6a35d5e7e5e2e /libavformat/rtmpproto.c
parent4d9ec050a21c953f5a6e31483cf5ebd344afa3fd (diff)
downloadffmpeg-1eef08f98cc2f216ecc44041ad727aaa7fa2c705.tar.gz
rtmp: Use nb_invokes for all invoke commands
704af3e29c3ddbc22ac5c8f40e5a0f860d53ac4c broke publishing of rtmp streams, at least publishing to Wowza servers. This changes all invoke commands to use nb_invokes. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtmpproto.c')
-rw-r--r--libavformat/rtmpproto.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 54213b1dd0..69acd864dc 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -75,6 +75,7 @@ typedef struct RTMPContext {
uint8_t flv_header[11]; ///< partial incoming flv packet header
int flv_header_bytes; ///< number of initialized bytes in flv_header
int nb_invokes; ///< keeps track of invoke messages
+ int create_stream_invoke; ///< invoke id for the create stream command
} RTMPContext;
#define PLAYER_KEY_OPEN_PART_LEN 30 ///< length of partial key used for first client digest signing
@@ -115,7 +116,7 @@ static void gen_connect(URLContext *s, RTMPContext *rt, const char *proto,
ff_url_join(tcurl, sizeof(tcurl), proto, NULL, host, port, "/%s", rt->app);
ff_amf_write_string(&p, "connect");
- ff_amf_write_number(&p, 1.0);
+ ff_amf_write_number(&p, ++rt->nb_invokes);
ff_amf_write_object_start(&p);
ff_amf_write_field_name(&p, "app");
ff_amf_write_string(&p, rt->app);
@@ -237,6 +238,7 @@ static void gen_create_stream(URLContext *s, RTMPContext *rt)
ff_amf_write_string(&p, "createStream");
ff_amf_write_number(&p, ++rt->nb_invokes);
ff_amf_write_null(&p);
+ rt->create_stream_invoke = rt->nb_invokes;
ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
ff_rtmp_packet_destroy(&pkt);
@@ -257,7 +259,7 @@ static void gen_delete_stream(URLContext *s, RTMPContext *rt)
p = pkt.data;
ff_amf_write_string(&p, "deleteStream");
- ff_amf_write_number(&p, 0.0);
+ ff_amf_write_number(&p, ++rt->nb_invokes);
ff_amf_write_null(&p);
ff_amf_write_number(&p, rt->main_channel_id);
@@ -281,7 +283,7 @@ static void gen_play(URLContext *s, RTMPContext *rt)
p = pkt.data;
ff_amf_write_string(&p, "play");
- ff_amf_write_number(&p, 0.0);
+ ff_amf_write_number(&p, ++rt->nb_invokes);
ff_amf_write_null(&p);
ff_amf_write_string(&p, rt->playpath);
@@ -315,7 +317,7 @@ static void gen_publish(URLContext *s, RTMPContext *rt)
p = pkt.data;
ff_amf_write_string(&p, "publish");
- ff_amf_write_number(&p, 0.0);
+ ff_amf_write_number(&p, ++rt->nb_invokes);
ff_amf_write_null(&p);
ff_amf_write_string(&p, rt->playpath);
ff_amf_write_string(&p, "live");
@@ -614,7 +616,7 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
* releaseStream and FCPublish calls */
if (!pkt->data[10]) {
int pkt_id = (int) av_int2dbl(AV_RB64(pkt->data + 11));
- if (pkt_id == 4)
+ if (pkt_id == rt->create_stream_invoke)
rt->state = STATE_CONNECTING;
}
if (rt->state != STATE_CONNECTING)