[FFmpeg-devel] [PATCH] ffserver rtsp bug fixes

Howard Chu hyc
Tue May 18 16:02:49 CEST 2010

Howard Chu wrote:
> Martin suggested I repost the explanations of each patch, so I'm doing this here.

>> @@ -3872,6 +3878,15 @@
>>       st->codec = avcodec_alloc_context();
>>       stream->streams[stream->nb_streams++] = st;
>>       memcpy(st->codec, av, sizeof(AVCodecContext));
>> +    codec = avcodec_find_encoder(st->codec->codec_id);
>> +    if (!codec) {
>> +        http_log("Encoder (codec id %d) not found\n", st->codec->codec_id);
>> +        exit(1);
>> +    }
>> +    if (avcodec_open(st->codec, codec)<  0) {
>> +        http_log("Error opening encoder\n");
>> +        exit(1);
>> +    }
>>   }
>>   static enum CodecID opt_audio_codec(const char *arg)
> This was the first fix I posted. The codec must actually be opened/initialized
> to give it a chance to set up its extradata when global headers are
> configured. Otherwise the config option has no effect. Without this patch RTSP
> always fails when trying to use AAC; you get the message "AAC with no global
> headers is currently not supported."

Found a better approach to this problem - ffmpeg actually gives ffserver the 
extradata that is needed, but ffserver was reading it into the feed stream and 
not pushing it down into the actual stream. With this set of patches it just 
uses the same codec structure for all streams that depend on the feed, so the 
info gets set properly in one place and is used by all the relevant streams.

   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dif2.txt
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100518/bc586c6a/attachment.txt>

More information about the ffmpeg-devel mailing list