[FFmpeg-devel] Realmedia patch

Ronald S. Bultje rsbultje
Fri Aug 22 20:23:38 CEST 2008


Hi Luca,

On Fri, Aug 22, 2008 at 2:08 PM, Luca Abeni <lucabe72 at email.it> wrote:
> Ok, thanks. I think the first patch looks less controversial than the
> other one ;-)

It's dangerous to take old ones, they don't implement all features.
The first one, for example, only plays AAC, not cook, and you have to
manually select streamrules by hardcoded values in the code...

>> Index: ffmpeg/libavformat/rtsp.c
>> ===================================================================
>> --- ffmpeg.orig/libavformat/rtsp.c    2008-07-03 08:46:52.000000000 -0400
>> +++ ffmpeg/libavformat/rtsp.c 2008-07-03 08:48:34.000000000 -0400
>> @@ -27,6 +27,7 @@
>>  #include "network.h"
>>  #include "rtsp.h"
>>
>> +#include "md5.h"
>>  #include "rtp_internal.h"
>>
>>  //#define DEBUG
>> @@ -523,6 +524,18 @@
>>              rtsp_parse_range_npt(p, &start, &end);
>>              s->start_time= start;
>>              s->duration= (end==AV_NOPTS_VALUE)?AV_NOPTS_VALUE:end-start; // AV_NOPTS_VALUE means live broadcast (and can't seek)
>> +        } else if (av_strstart(p, "AvgBitRate:integer;", &p)) {
>> +            s->streams[s->nb_streams - 1]->codec->bit_rate = atoi(p);
>> +        } else if (av_strstart(p, "RMFF 1.0 Flags:", &p) ||
>> +                   av_strstart(p, "OpaqueData:", &p) ||
>> +                   av_strstart(p, "ASMRuleBook:", &p)) {
>
> I think that we should only use standard tags here (and not the "RMFF",
> "OpaqueData", "ASMRuleBook", ... keywords used by real). Can you just
> call parse_sdp_a_line() in the final "else" case (without checking for
> any particular tag)? Then, you can check for the real tags in the
> rdt_parse_sdp_line() function.

So s/else if(..||..||..)/else/? Sure, no problem.

> [...]
>> +    /* request options supported by the server */
>> +    for (is_real_datatype = 0;; is_real_datatype++) {
>> +        snprintf(cmd, sizeof(cmd),
>> +                 "OPTIONS %s RTSP/1.0\r\n", s->filename);
>> +        if (is_real_datatype)
>> +            av_strlcat(cmd,
>> +                       "User-Agent: RealMedia Player Version 6.0.9.1235 (linux-2.0-libc6-i386-gcc2.95\r\n"
>> +                       "ClientChallenge: 9e26d33f2984236010ef6253fb1887f7\r\n"
>> +                       "PlayerStarttime: [28/03/2003:22:50:23 00:00]\r\n"
>> +                       "CompanyID: KnKV4M4I/B2FjJ1TToLycw==\r\n"
>> +                       "GUID: 00000000-0000-0000-0000-000000000000\r\n"
>> +                       "RegionData: 0\r\n"
>> +                       "ClientID: Linux_2.4_6.0.9.1235_play32_RN01_EN_586\r\n",
>> +                       sizeof(cmd));
>
> Is this really needed? I mean: claiming to be RealMedia Player, sending
> a random Starttime, etc...
> Are all these tags needed? (what happens if you remove ClientID,
> User-Agent, etc...?)
>
> (anyway, I think that the usage of the "OPTIONS" command to identify the
> server can be committed independently from the rest of the patch)
>
> [...]
>> +    if (is_real_datatype)
>> +        av_strlcat(cmd,
>> +                   "Bandwidth: 250000\r\n"
>> +                   "GUID: 00000000-0000-0000-0000-000000000000\r\n"
>> +                   "RegionData: 0\r\n"
>> +                   "ClientID: Linux_2.4_6.0.9.1235_play32_RN01_EN_586\r\n"
>> +                   "SupportsMaximumASMBandwidth: 1\r\n"
>> +                   "Language: en-US\r\n"
>> +                   "Require: com.real.retain-entity-for-setup\r\n",
>> +                   sizeof(cmd));
>
> Again, it would be better to avoid sending fake information.

I've tested a few of them, and the servers would refuse to work
without it. However, I haven't done systematic testing (I guess that
was on my TODO list for a while and then it dropped off somehow). I
will do this and test each value and make sure such fake information
is required for correct playback.

> I also have another question: it seems to me that in this patch
> (rtsp-realmedia.patch) you are not explicitly creating new AVStreams
> with av_new_stream. So, only one AVStream is created, when the "m=" SDP
> line is parsed. But an RM stream can contain more than one stream (for
> example, an audio stream and a video stream), right? Where are the
> additional AVStreams created? I am wondering if it would simpler to use
> an approach similar to the one used for parsing TS in RTP (not creating
> and AVStream in rtsp.c, but leave the streams creation to the RM demuxer)?

I have honestly only tested with single-stream real streams... Most
multi-streams (video+audio) are protected anyway. I need to test this
with a proper set of test-streams. Anyone know good test-streams that
ffmpeg has codecs for? (E.g. h264+AAC or so, does RV9/10 work?), i.e.
streams that - when dumped by mplayer - can be played by ffplay.

Thanks,
Ronald




More information about the ffmpeg-devel mailing list