mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1183007. Part 1 - provide a wrapper function so that all read from mAudioEndTime must be through MDSM::AudioEndTime(). r=kinetik.
This commit is contained in:
parent
89c4a876ba
commit
8325e3c2ad
@ -358,8 +358,8 @@ int64_t MediaDecoderStateMachine::GetDecodedAudioDuration()
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
int64_t audioDecoded = AudioQueue().Duration();
|
||||
if (mAudioEndTime != -1) {
|
||||
audioDecoded += mAudioEndTime - GetMediaTime();
|
||||
if (AudioEndTime() != -1) {
|
||||
audioDecoded += AudioEndTime() - GetMediaTime();
|
||||
}
|
||||
return audioDecoded;
|
||||
}
|
||||
@ -1776,7 +1776,7 @@ int64_t MediaDecoderStateMachine::AudioDecodedUsecs()
|
||||
// The amount of audio we have decoded is the amount of audio data we've
|
||||
// already decoded and pushed to the hardware, plus the amount of audio
|
||||
// data waiting to be pushed to the hardware.
|
||||
int64_t pushed = (mAudioEndTime != -1) ? (mAudioEndTime - GetMediaTime()) : 0;
|
||||
int64_t pushed = (AudioEndTime() != -1) ? (AudioEndTime() - GetMediaTime()) : 0;
|
||||
|
||||
// Currently for real time streams, AudioQueue().Duration() produce
|
||||
// wrong values (Bug 1114434), so we use frame counts to calculate duration.
|
||||
@ -2428,7 +2428,7 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
|
||||
if (mPlayState == MediaDecoder::PLAY_STATE_PLAYING &&
|
||||
!mSentPlaybackEndedEvent)
|
||||
{
|
||||
int64_t clockTime = std::max(mAudioEndTime, mVideoFrameEndTime);
|
||||
int64_t clockTime = std::max(AudioEndTime(), mVideoFrameEndTime);
|
||||
clockTime = std::max(int64_t(0), std::max(clockTime, Duration().ToMicroseconds()));
|
||||
UpdatePlaybackPosition(clockTime);
|
||||
|
||||
@ -2733,9 +2733,9 @@ void MediaDecoderStateMachine::UpdateRenderedVideoFrames()
|
||||
// Cap the current time to the larger of the audio and video end time.
|
||||
// This ensures that if we're running off the system clock, we don't
|
||||
// advance the clock to after the media end time.
|
||||
if (mVideoFrameEndTime != -1 || mAudioEndTime != -1) {
|
||||
if (mVideoFrameEndTime != -1 || AudioEndTime() != -1) {
|
||||
// These will be non -1 if we've displayed a video frame, or played an audio frame.
|
||||
int64_t t = std::min(clockTime, std::max(mVideoFrameEndTime, mAudioEndTime));
|
||||
int64_t t = std::min(clockTime, std::max(mVideoFrameEndTime, AudioEndTime()));
|
||||
// FIXME: Bug 1091422 - chained ogg files hit this assertion.
|
||||
//MOZ_ASSERT(t >= GetMediaTime());
|
||||
if (t > GetMediaTime()) {
|
||||
@ -3070,11 +3070,19 @@ void MediaDecoderStateMachine::QueueMetadata(int64_t aPublishTime,
|
||||
mMetadataManager.QueueMetadata(metadata);
|
||||
}
|
||||
|
||||
int64_t
|
||||
MediaDecoderStateMachine::AudioEndTime() const
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
return mAudioEndTime;
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::OnAudioEndTimeUpdate(int64_t aAudioEndTime)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
MOZ_ASSERT(aAudioEndTime >= mAudioEndTime);
|
||||
MOZ_ASSERT(aAudioEndTime >= AudioEndTime());
|
||||
mAudioEndTime = aAudioEndTime;
|
||||
}
|
||||
|
||||
|
@ -1070,6 +1070,7 @@ protected:
|
||||
// hardware in microseconds. This will approximately be the end time of the
|
||||
// audio stream, unless another frame is pushed to the hardware.
|
||||
int64_t mAudioEndTime;
|
||||
int64_t AudioEndTime() const;
|
||||
|
||||
// The end time of the last decoded audio frame. This signifies the end of
|
||||
// decoded audio data. Used to check if we are low in decoded data.
|
||||
|
Loading…
Reference in New Issue
Block a user