[FFmpeg-trac] #11469(ffmpeg:open): ffmpeg_demux: readrate plays "catch up" if output is blocked, then later resumed

FFmpeg trac at avcodec.org
Sun Feb 16 05:16:35 EET 2025


#11469: ffmpeg_demux: readrate plays "catch up" if output is blocked, then later
resumed
-------------------------------------+-------------------------------------
             Reporter:  Wallboy      |                    Owner:  (none)
                 Type:  defect       |                   Status:  open
             Priority:  normal       |                Component:  ffmpeg
              Version:  git-master   |               Resolution:
             Keywords:  demuxer      |               Blocked By:
  readrate                           |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Comment (by Wallboy):

 I've been messing around with a potential hacky solution.

 Just before the following condition:

 {{{
 if (pts - burst_until > now)...
 }}}

 Add the following check to see if we've fallen behind, and then offset
 wallclock_start and recalculate now:

 {{{
 if (now - pts > 500000) {  // arbitrary 0.5 sec threshold
     d->wallclock_start += now - (pts - burst_until);
     now = (av_gettime_relative() - d->wallclock_start) * d->readrate +
 stream_ts_offset;
 }
 }}}

 This seems to do the job for my use case scenarios, but I'm sure there are
 some edge cases to be aware of. At least it's some sort of idea for a
 potential real solution.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/11469#comment:3>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list