[FFmpeg-devel] [RFC] Eliminate -re and make -rate_emu set by AVOption
Baptiste Coudurier
baptiste.coudurier
Wed Jul 16 21:50:10 CEST 2008
Hi Luca,
Luca Abeni wrote:
> Hi Stefano,
>
> sorry for the late reply, but I wanted to triple-think about this issue
> before writing something...
>
> Stefano Sabatini wrote:
> [...]
>> My solution is to make -rate_emu settable through AVOption options
>> using rate_emu, then remove the -re option.
>>
>> This alone doesn't fix the problems for audio-only multimedia streams
>> streaming, there are still timestamp issues to be addressed.
>
> If I understand your patch correctly, it allows to set the rate_emu
> field in the audio codec context, but it does not provide support for
> "audio frame rate emulation". In fact, I believe that the following code
> can only work for the video streams:
>> /* frame rate emulation */
>> if (ist->st->codec->rate_emu) {
>> int64_t pts = av_rescale((int64_t) ist->frame * ist->st->codec->time_base.num, 1000000, ist->st->codec->time_base.den);
>> int64_t now = av_gettime() - ist->start;
>> if (pts > now)
>> usleep(pts - now);
>>
>> ist->frame++;
>> }
> (I do not believe that an audio pts can be computed as frame number *
> time base).
>
> So, I suspect that setting rate_emu for audio codecs is quite pointless...
> (In other words: if we really want to go this path, I believe we should
> first fix audio frame rate emulation, and then enable it in a second time)
>
> Moreover, why does the rate emulation code cited above compute a pts in
> that way? Cannot ist->next_pts (or something similar) be used?
I think this would be more correct indeed.
> I also have a second (bigger) doubt: in my opinion, rate_emu should not
> be a field in AVCodecContext. In fact, nothing else than ffmpeg.c uses
> it (unless I misread some code). So, I would be tempted to remove this
> field from AVCodecContext, and to use the global rate_emu variable in
> the "if()" quoted above (so, I would change "if
> (ist->st->codec->rate_emu) {" in "if (rate_emu) {").
Yes, I tend to agree with this.
[...]
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
Smartjog USA Inc. http://www.smartjog.com
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
More information about the ffmpeg-devel
mailing list