Bug 589626 - Refactor timestamp notation in nsBuiltinDecoderStateMachine. r=kinetik a=blocking2.0
This commit is contained in:
@@ -164,7 +164,7 @@ PRBool nsBuiltinDecoderStateMachine::HasFutureAudio() const {
|
||||
mDecoder->GetMonitor().AssertCurrentThreadIn();
|
||||
PRBool aboveLowAudioThreshold = PR_FALSE;
|
||||
if (mAudioEndTime != -1) {
|
||||
aboveLowAudioThreshold = mAudioEndTime - mCurrentFrameTime + mStartTime > LOW_AUDIO_MS;
|
||||
aboveLowAudioThreshold = mAudioEndTime - GetMediaTime() > LOW_AUDIO_MS;
|
||||
}
|
||||
return HasAudio() &&
|
||||
!mAudioCompleted &&
|
||||
@@ -259,7 +259,7 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
|
||||
PRInt64 audioDecoded = 0;
|
||||
{
|
||||
MonitorAutoEnter mon(mDecoder->GetMonitor());
|
||||
currentTime = mCurrentFrameTime + mStartTime;
|
||||
currentTime = GetMediaTime();
|
||||
audioDecoded = mReader->mAudioQueue.Duration();
|
||||
if (mAudioEndTime != -1) {
|
||||
audioDecoded += mAudioEndTime - currentTime;
|
||||
@@ -466,7 +466,7 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
|
||||
break;
|
||||
}
|
||||
|
||||
PRInt64 audioAhead = mAudioEndTime - mCurrentFrameTime - mStartTime;
|
||||
PRInt64 audioAhead = mAudioEndTime - GetMediaTime();
|
||||
if (audioAhead > AMPLE_AUDIO_MS) {
|
||||
// We've pushed enough audio onto the hardware that we've queued up a
|
||||
// significant amount ahead of the playback position. The decode
|
||||
@@ -668,7 +668,7 @@ void nsBuiltinDecoderStateMachine::UpdatePlaybackPosition(PRInt64 aTime)
|
||||
}
|
||||
|
||||
// Notify DOM of any queued up audioavailable events
|
||||
mEventManager.DispatchPendingEvents(mCurrentFrameTime + mStartTime);
|
||||
mEventManager.DispatchPendingEvents(GetMediaTime());
|
||||
}
|
||||
|
||||
void nsBuiltinDecoderStateMachine::ClearPositionChangeFlag()
|
||||
@@ -996,6 +996,7 @@ nsresult nsBuiltinDecoderStateMachine::Run()
|
||||
StopPlayback(AUDIO_SHUTDOWN);
|
||||
StopDecodeThreads();
|
||||
ResetPlayback();
|
||||
PRInt64 currentTime = GetMediaTime();
|
||||
nsresult res;
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
@@ -1004,7 +1005,7 @@ nsresult nsBuiltinDecoderStateMachine::Run()
|
||||
res = mReader->Seek(seekTime,
|
||||
mStartTime,
|
||||
mEndTime,
|
||||
mCurrentFrameTime + mStartTime);
|
||||
currentTime);
|
||||
}
|
||||
if (NS_SUCCEEDED(res)){
|
||||
PRInt64 audioTime = seekTime;
|
||||
@@ -1042,7 +1043,7 @@ nsresult nsBuiltinDecoderStateMachine::Run()
|
||||
// if we need to seek again.
|
||||
|
||||
nsCOMPtr<nsIRunnable> stopEvent;
|
||||
if (mCurrentFrameTime == mEndTime) {
|
||||
if (GetMediaTime() == mEndTime) {
|
||||
LOG(PR_LOG_DEBUG, ("%p Changed state from SEEKING (to %lldms) to COMPLETED",
|
||||
mDecoder, seekTime));
|
||||
stopEvent = NS_NewRunnableMethod(mDecoder, &nsBuiltinDecoder::SeekingStoppedAtEnd);
|
||||
|
||||
Reference in New Issue
Block a user