b=1023697 change MediaDecoderStateMachine::mSyncPointInMediaStream from StreamTime to µs r=roc

This allows the conversion from StreamTime to be performed while a stream is
available.

--HG--
extra : transplant_source : %3A%AD%5C%1A%84%C3%1BC%8B%04%D5%5B%90%3Cv%BE%A6%D6%C0%9D
This commit is contained in:
Karl Tomlinson 2014-06-12 16:44:56 +12:00
Родитель a87b3e8941
Коммит 6d42cde63e
4 изменённых файлов: 11 добавлений и 8 удалений

Просмотреть файл

@ -222,7 +222,8 @@ MediaDecoder::DecodedStreamGraphListener::DecodedStreamGraphListener(MediaStream
: mData(aData),
mMutex("MediaDecoder::DecodedStreamData::mMutex"),
mStream(aStream),
mLastOutputTime(aStream->GetCurrentTime()),
mLastOutputTime(aStream->
StreamTimeToMicroseconds(aStream->GetCurrentTime())),
mStreamFinishedOnMainThread(false)
{
}
@ -233,7 +234,8 @@ MediaDecoder::DecodedStreamGraphListener::NotifyOutput(MediaStreamGraph* aGraph,
{
MutexAutoLock lock(mMutex);
if (mStream) {
mLastOutputTime = mStream->GraphTimeToStreamTime(aCurrentTime);
mLastOutputTime = mStream->
StreamTimeToMicroseconds(mStream->GraphTimeToStreamTime(aCurrentTime));
}
}

Просмотреть файл

@ -395,7 +395,8 @@ public:
int64_t aInitialTime, SourceMediaStream* aStream);
~DecodedStreamData();
StreamTime GetLastOutputTime() { return mListener->GetLastOutputTime(); }
// microseconds
int64_t GetLastOutputTime() { return mListener->GetLastOutputTime(); }
bool IsFinished() { return mListener->IsFinishedOnMainThread(); }
// The following group of fields are protected by the decoder's monitor
@ -444,7 +445,7 @@ public:
void DoNotifyFinished();
StreamTime GetLastOutputTime()
int64_t GetLastOutputTime() // microseconds
{
MutexAutoLock lock(mMutex);
return mLastOutputTime;
@ -477,7 +478,7 @@ public:
// Protected by mMutex
nsRefPtr<MediaStream> mStream;
// Protected by mMutex
StreamTime mLastOutputTime;
int64_t mLastOutputTime; // microseconds
// Protected by mMutex
bool mStreamFinishedOnMainThread;
};

Просмотреть файл

@ -1411,8 +1411,8 @@ int64_t MediaDecoderStateMachine::GetCurrentTimeViaMediaStreamSync()
AssertCurrentThreadInMonitor();
NS_ASSERTION(mSyncPointInDecodedStream >= 0, "Should have set up sync point");
DecodedStreamData* stream = mDecoder->GetDecodedStream();
StreamTime streamDelta = stream->GetLastOutputTime() - mSyncPointInMediaStream;
return mSyncPointInDecodedStream + MediaTimeToMicroseconds(streamDelta);
int64_t streamDelta = stream->GetLastOutputTime() - mSyncPointInMediaStream;
return mSyncPointInDecodedStream + streamDelta;
}
void MediaDecoderStateMachine::StartPlayback()

Просмотреть файл

@ -732,7 +732,7 @@ protected:
// When we start writing decoded data to a new DecodedDataStream, or we
// restart writing due to PlaybackStarted(), we record where we are in the
// MediaStream and what that corresponds to in the media.
StreamTime mSyncPointInMediaStream;
int64_t mSyncPointInMediaStream; // microseconds
int64_t mSyncPointInDecodedStream; // microseconds
// When the playbackRate changes, and there is no audio clock, it is necessary