[FFmpeg-devel] [PATCH] rtmpproto: send swfverify value as swfurl if latter is unused

Ricardo Constantino wiiaboo at gmail.com
Mon Mar 27 16:40:15 EEST 2017


On 27 March 2017 at 00:15, Michael Niedermayer <michael at niedermayer.cc>
wrote:

> On Mon, Mar 20, 2017 at 08:22:51PM +0000, Ricardo Constantino wrote:
> > Replicates lavf/librtmp.c behavior in L149-156 and rtmpdump's
> > behavior with "--swfVfy <url>" passing the url to swfUrl.
> >
> > Fixes trac ticket #5549.
> > ---
> >  libavformat/rtmpproto.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
> > index 5d7ad795ed..cecb6b4d9f 100644
> > --- a/libavformat/rtmpproto.c
> > +++ b/libavformat/rtmpproto.c
> > @@ -341,9 +341,12 @@ static int gen_connect(URLContext *s, RTMPContext
> *rt)
> >      ff_amf_write_field_name(&p, "flashVer");
> >      ff_amf_write_string(&p, rt->flashver);
> >
> > -    if (rt->swfurl) {
> > +    if (rt->swfurl || rt->swfverify) {
> >          ff_amf_write_field_name(&p, "swfUrl");
> > -        ff_amf_write_string(&p, rt->swfurl);
> > +        if (rt->swfurl)
> > +            ff_amf_write_string(&p, rt->swfurl);
> > +        else
> > +            ff_amf_write_string(&p, rt->swfverify);
>
> lavf/librtmp.c adds " swfVfy=1"
> why does this here not ?
>

The field name is swfUrl in both librtmp.c and rtmpproto.

In lavf/librtmp.c, -rtmp_swfverify accepts the swf URL and librtmp computes
the hash
if swfVfy=1 and sets swfUrl to the value of rtmp_swfverify.

In lavf/rtmpproto.c, -rtmp_swfverify only computes the hash but doesn't set
swfUrl
which is needed by the server, so you need to repeat the same URL to
-rtmp_swfurl.

In rtmpdump binary, there's both --swfUrl and --swfVfy and both take the
swf url,
but the latter also sets swfUrl while also setting swfVfy=1 which is needed
to
prompt librtmp to compute the hash.

That's my interpretation of it, no idea if it is absolutely correct, since
I don't
have a lot of RTMP sources to check.


More information about the ffmpeg-devel mailing list