[FFmpeg-cvslog] rtmp: Use nb_invokes for all invoke commands
Martin Storsjö
git at videolan.org
Thu Dec 8 00:31:48 CET 2011
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Mon Dec 5 12:35:06 2011 +0200| [1eef08f98cc2f216ecc44041ad727aaa7fa2c705] | committer: Martin Storsjö
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 at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1eef08f98cc2f216ecc44041ad727aaa7fa2c705
---
libavformat/rtmpproto.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 54213b1..69acd86 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)
More information about the ffmpeg-cvslog
mailing list