fix: preserve audio samples across Miruro timestamp jitter
This commit is contained in:
@@ -1032,8 +1032,10 @@ struct Player {
|
||||
}
|
||||
const double timestamp = framePts(track, decoded);
|
||||
const double tick = av_q2d(track.stream()->time_base);
|
||||
const bool contiguous = continuing && std::abs(timestamp - track.nextPts) <= tick + 1.0 / rate;
|
||||
// Quantized packet PTS and rounded resampler delay must not insert/drop PCM samples.
|
||||
// Some TS muxers round timestamps to milliseconds despite a 90 kHz timebase.
|
||||
// Allow two rounded endpoints of jitter; real gaps still insert silence.
|
||||
const bool contiguous = continuing &&
|
||||
std::abs(timestamp - track.nextPts) <= std::max(tick, 0.002) + 1.0 / rate;
|
||||
const int64_t delayBase = static_cast<int64_t>(rate) * sampleRate;
|
||||
pcmPts = contiguous ? resampleNextPts :
|
||||
timestamp - static_cast<double>(swr_get_delay(resampler, delayBase)) / delayBase;
|
||||
|
||||
Reference in New Issue
Block a user