mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 828901 - Get the seek time as mBasePosition instead of the stream position in video-only stream when changing the playbackRate and seeking at the same time. r=kinetik
This commit is contained in:
parent
866ba5a7d9
commit
0e6d22d211
@ -2268,11 +2268,8 @@ int64_t MediaDecoderStateMachine::GetVideoStreamPosition()
|
||||
|
||||
int64_t pos = DurationToUsecs(TimeStamp::Now() - mPlayStartTime) + mPlayDuration;
|
||||
pos -= mBasePosition;
|
||||
if (pos >= 0) {
|
||||
int64_t final = mBasePosition + pos * mPlaybackRate + mStartTime;
|
||||
return final;
|
||||
}
|
||||
return mPlayDuration + mStartTime;
|
||||
NS_ASSERTION(pos >= 0, "Video stream position should be positive.");
|
||||
return mBasePosition + pos * mPlaybackRate + mStartTime;
|
||||
}
|
||||
|
||||
int64_t MediaDecoderStateMachine::GetClock() {
|
||||
@ -2731,12 +2728,14 @@ void MediaDecoderStateMachine::SetPlaybackRate(double aPlaybackRate)
|
||||
// Get position of the last time we changed the rate.
|
||||
if (!HasAudio()) {
|
||||
// mBasePosition is a position in the video stream, not an absolute time.
|
||||
mBasePosition = GetVideoStreamPosition();
|
||||
if (IsPlaying()) {
|
||||
mPlayDuration = mBasePosition - mStartTime;
|
||||
mResetPlayStartTime = true;
|
||||
mPlayStartTime = TimeStamp::Now();
|
||||
if (mState == DECODER_STATE_SEEKING) {
|
||||
mBasePosition = mSeekTime;
|
||||
} else {
|
||||
mBasePosition = GetVideoStreamPosition();
|
||||
}
|
||||
mPlayDuration = mBasePosition - mStartTime;
|
||||
mResetPlayStartTime = true;
|
||||
mPlayStartTime = TimeStamp::Now();
|
||||
}
|
||||
|
||||
mPlaybackRate = aPlaybackRate;
|
||||
|
Loading…
Reference in New Issue
Block a user