Bug 1191173 - Mirror MediaDecoder::mSameOriginMedia in MDSM. r=jya.

This commit is contained in:
JW Wang 2015-08-06 18:05:30 +08:00
Родитель 616e6d2dd6
Коммит c1624b854e
4 изменённых файлов: 19 добавлений и 17 удалений

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

@ -366,7 +366,6 @@ MediaDecoder::MediaDecoder() :
mLogicalPosition(0.0),
mDuration(std::numeric_limits<double>::quiet_NaN()),
mMediaSeekable(true),
mSameOriginMedia(false),
mReentrantMonitor("media.decoder"),
mIgnoreProgressData(false),
mInfiniteStream(false),
@ -412,7 +411,9 @@ MediaDecoder::MediaDecoder() :
mNextState(AbstractThread::MainThread(), PLAY_STATE_PAUSED,
"MediaDecoder::mNextState (Canonical)"),
mLogicallySeeking(AbstractThread::MainThread(), false,
"MediaDecoder::mLogicallySeeking (Canonical)")
"MediaDecoder::mLogicallySeeking (Canonical)"),
mSameOriginMedia(AbstractThread::MainThread(), false,
"MediaDecoder::mSameOriginMedia (Canonical)")
{
MOZ_COUNT_CTOR(MediaDecoder);
MOZ_ASSERT(NS_IsMainThread());
@ -776,12 +777,6 @@ void MediaDecoder::UpdateSameOriginStatus(bool aSameOrigin)
mSameOriginMedia = aSameOrigin;
}
bool MediaDecoder::IsSameOriginMedia()
{
GetReentrantMonitor().AssertCurrentThreadIn();
return mSameOriginMedia;
}
bool MediaDecoder::IsSeeking() const
{
MOZ_ASSERT(NS_IsMainThread());

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

@ -572,10 +572,6 @@ public:
// The actual playback rate computation. The monitor must be held.
virtual double ComputePlaybackRate(bool* aReliable);
// Return true when the media is same-origin with the element. The monitor
// must be held.
bool IsSameOriginMedia();
// Returns true if we can play the entire media through without stopping
// to buffer, given the current download and playback rates.
bool CanPlayThrough();
@ -942,10 +938,6 @@ protected:
// True if the media is seekable (i.e. supports random access).
bool mMediaSeekable;
// True if the media is same-origin with the element. Data can only be
// passed to MediaStreams when this is true.
bool mSameOriginMedia;
/******
* The following member variables can be accessed from any thread.
******/
@ -1120,6 +1112,10 @@ protected:
// True if the decoder is seeking.
Canonical<bool> mLogicallySeeking;
// True if the media is same-origin with the element. Data can only be
// passed to MediaStreams when this is true.
Canonical<bool> mSameOriginMedia;
public:
AbstractCanonical<media::NullableTimeUnit>* CanonicalDurationOrNull() override;
AbstractCanonical<double>* CanonicalVolume() {
@ -1146,6 +1142,9 @@ public:
AbstractCanonical<bool>* CanonicalLogicallySeeking() {
return &mLogicallySeeking;
}
AbstractCanonical<bool>* CanonicalSameOriginMedia() {
return &mSameOriginMedia;
}
};
} // namespace mozilla

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

@ -242,6 +242,8 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
"MediaDecoderStateMachine::mLogicalPlaybackRate (Mirror)"),
mPreservesPitch(mTaskQueue, true,
"MediaDecoderStateMachine::mPreservesPitch (Mirror)"),
mSameOriginMedia(mTaskQueue, false,
"MediaDecoderStateMachine::mSameOriginMedia (Mirror)"),
mDuration(mTaskQueue, NullableTimeUnit(),
"MediaDecoderStateMachine::mDuration (Canonical"),
mIsShutdown(mTaskQueue, false,
@ -317,6 +319,7 @@ MediaDecoderStateMachine::InitializationTask()
mVolume.Connect(mDecoder->CanonicalVolume());
mLogicalPlaybackRate.Connect(mDecoder->CanonicalPlaybackRate());
mPreservesPitch.Connect(mDecoder->CanonicalPreservesPitch());
mSameOriginMedia.Connect(mDecoder->CanonicalSameOriginMedia());
// Initialize watchers.
mWatchManager.Watch(mBuffered, &MediaDecoderStateMachine::BufferedRangeUpdated);
@ -373,7 +376,7 @@ void MediaDecoderStateMachine::SendStreamData()
AssertCurrentThreadInMonitor();
MOZ_ASSERT(!mAudioSink, "Should've been stopped in RunStateMachine()");
bool finished = mDecodedStream->SendData(mVolume, mDecoder->IsSameOriginMedia());
bool finished = mDecodedStream->SendData(mVolume, mSameOriginMedia);
const auto clockTime = GetClock();
while (true) {
@ -2217,6 +2220,7 @@ MediaDecoderStateMachine::FinishShutdown()
mVolume.DisconnectIfConnected();
mLogicalPlaybackRate.DisconnectIfConnected();
mPreservesPitch.DisconnectIfConnected();
mSameOriginMedia.DisconnectIfConnected();
mDuration.DisconnectAll();
mIsShutdown.DisconnectAll();
mNextFrameStatus.DisconnectAll();

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

@ -1318,6 +1318,10 @@ private:
// Pitch preservation for the playback rate.
Mirror<bool> mPreservesPitch;
// True if the media is same-origin with the element. Data can only be
// passed to MediaStreams when this is true.
Mirror<bool> mSameOriginMedia;
// Duration of the media. This is guaranteed to be non-null after we finish
// decoding the first frame.
Canonical<media::NullableTimeUnit> mDuration;