mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
More fixes for the audio clock
The audio_clock for the decoder represents the end of the current packet, so it needs to be adjusted back to match the position that's actually going to be read next.
This commit is contained in:
parent
1a771ae671
commit
4561c22e2b
@ -416,7 +416,7 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
mFramePos = std::min(static_cast<int>(mFrameSize), sample_skip);
|
||||
mFramePos = std::min<ssize_t>(mFrameSize, sample_skip);
|
||||
sample_skip -= mFramePos;
|
||||
}
|
||||
|
||||
@ -471,7 +471,9 @@ public:
|
||||
|
||||
size_t getSampleOffset()
|
||||
{
|
||||
return (size_t)(is->audio_clock*is->audio_st->codec->sample_rate);
|
||||
ssize_t clock_delay = (mFrameSize-mFramePos) / is->audio_st->codec->channels /
|
||||
av_get_bytes_per_sample(is->audio_st->codec->sample_fmt);
|
||||
return (size_t)(is->audio_clock*is->audio_st->codec->sample_rate) - clock_delay;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user