[FFmpeg-devel] [PATCH 5/6] RTMP output: implement rtmp-output
Kostya
kostya.shishkov
Fri Dec 4 16:42:19 CET 2009
On Fri, Dec 04, 2009 at 04:51:08PM +0200, Sergiy wrote:
> 2009/12/3 Sergiy <piratfm at gmail.com>:
> > 2009/12/3 Kostya <kostya.shishkov at gmail.com>:
> >> Ahem, sending "publish" instead of "play" in gen_play() is a bit
> >> counterintuitive, don't you think? Make it a separate function instead.
> >
> Added function for every output invoke.
>
> >>
> >> Ahem, why are doing this? There is rtmp_close() for final calls, and why
> >
> > I will try to move it there.
>
> Moved.
>
> One more hack added: for wowza, it doesn't send response for either
> fcpublish or releaseStream.
Looks almost OK except for:
[...]
>
> // write reply back to the server
> url_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE);
> + } else
> + url_write(rt->stream, serverdata+1, RTMP_HANDSHAKE_PACKET_SIZE);
> +
> return 0;
braces, please (in all such places)
[...]
> + rt->state = STATE_CONNECTING;
> gen_create_stream(s, rt);
> + break;
> + case STATE_FCPUBLISH:
> rt->state = STATE_CONNECTING;
> break;
> + case STATE_RELEASING:
> + rt->state = STATE_FCPUBLISH;
> + //hack for wms, it sending invoke only for create stream
hack for Wowza Media Server (or whatever), it does not send result for
FCPublish (or whatever) calls
[...]
> @@ -459,8 +614,12 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
> }
> t = ff_amf_get_field_value(ptr, data_end,
> "code", tmpstr, sizeof(tmpstr));
> - if (!t && !strcmp(tmpstr, "NetStream.Play.Start")) {
> + if (!t && (!strcmp(tmpstr, "NetStream.Play.Start") ||
> + !strcmp(tmpstr, "NetStream.Publish.Start"))) {
> + if (rt->is_input)
> rt->state = STATE_PLAYING;
> + else
> + rt->state = STATE_PUBLISHING;
> return 0;
obviously
if(!t && !strcmp("NetStream.Play.Start")) rt->state = STATE_PLAYING;
if(!t && !strcmp("NetStream.Publish.Start")) rt->state =
STATE_PUBLISHING;
what you did is semantically wrong
[...]
> + if(rt->is_input)
> av_freep(&rt->flv_data);
Again, this seems like unneeded condition. Probably you just forget to
send rt->flv_data = NULL along with rt->flv_size = 0.
More information about the ffmpeg-devel
mailing list