зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1163474. Part 2 - move MediaDecoder::mOutputStreams to DecodedStream. r=roc.
This commit is contained in:
Родитель
ddd8ef7478
Коммит
9f91817088
|
@ -204,4 +204,10 @@ DecodedStream::RecreateData(MediaDecoder* aDecoder, int64_t aInitialTime,
|
|||
mData.reset(new DecodedStreamData(aDecoder, aInitialTime, aStream));
|
||||
}
|
||||
|
||||
nsTArray<OutputStreamData>&
|
||||
DecodedStream::OutputStreams()
|
||||
{
|
||||
return mOutputStreams;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#define DecodedStream_h_
|
||||
|
||||
#include "nsRefPtr.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
|
||||
|
@ -101,9 +102,12 @@ public:
|
|||
void DestroyData();
|
||||
void RecreateData(MediaDecoder* aDecoder, int64_t aInitialTime,
|
||||
SourceMediaStream* aStream);
|
||||
nsTArray<OutputStreamData>& OutputStreams();
|
||||
|
||||
private:
|
||||
UniquePtr<DecodedStreamData> mData;
|
||||
// Data about MediaStreams that are being fed by the decoder.
|
||||
nsTArray<OutputStreamData> mOutputStreams;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -328,8 +328,9 @@ void MediaDecoder::DestroyDecodedStream()
|
|||
|
||||
// All streams are having their SourceMediaStream disconnected, so they
|
||||
// need to be explicitly blocked again.
|
||||
for (int32_t i = mOutputStreams.Length() - 1; i >= 0; --i) {
|
||||
OutputStreamData& os = mOutputStreams[i];
|
||||
auto& outputStreams = OutputStreams();
|
||||
for (int32_t i = outputStreams.Length() - 1; i >= 0; --i) {
|
||||
OutputStreamData& os = outputStreams[i];
|
||||
// Explicitly remove all existing ports.
|
||||
// This is not strictly necessary but it's good form.
|
||||
MOZ_ASSERT(os.mPort, "Double-delete of the ports!");
|
||||
|
@ -340,7 +341,7 @@ void MediaDecoder::DestroyDecodedStream()
|
|||
// be careful not to send any messages after the Destroy().
|
||||
if (os.mStream->IsDestroyed()) {
|
||||
// Probably the DOM MediaStream was GCed. Clean up.
|
||||
mOutputStreams.RemoveElementAt(i);
|
||||
outputStreams.RemoveElementAt(i);
|
||||
} else {
|
||||
os.mStream->ChangeExplicitBlockerCount(1);
|
||||
}
|
||||
|
@ -389,8 +390,9 @@ void MediaDecoder::RecreateDecodedStream(int64_t aStartTimeUSecs,
|
|||
// Note that the delay between removing ports in DestroyDecodedStream
|
||||
// and adding new ones won't cause a glitch since all graph operations
|
||||
// between main-thread stable states take effect atomically.
|
||||
for (int32_t i = mOutputStreams.Length() - 1; i >= 0; --i) {
|
||||
OutputStreamData& os = mOutputStreams[i];
|
||||
auto& outputStreams = OutputStreams();
|
||||
for (int32_t i = outputStreams.Length() - 1; i >= 0; --i) {
|
||||
OutputStreamData& os = outputStreams[i];
|
||||
MOZ_ASSERT(!os.mStream->IsDestroyed(),
|
||||
"Should've been removed in DestroyDecodedStream()");
|
||||
ConnectDecodedStreamToOutputStream(&os);
|
||||
|
@ -417,7 +419,7 @@ void MediaDecoder::AddOutputStream(ProcessedMediaStream* aStream,
|
|||
if (!GetDecodedStream()) {
|
||||
RecreateDecodedStream(mLogicalPosition, aStream->Graph());
|
||||
}
|
||||
OutputStreamData* os = mOutputStreams.AppendElement();
|
||||
OutputStreamData* os = OutputStreams().AppendElement();
|
||||
os->Init(this, aStream);
|
||||
ConnectDecodedStreamToOutputStream(os);
|
||||
if (aFinishWhenEnded) {
|
||||
|
|
|
@ -420,10 +420,11 @@ public:
|
|||
* Decoder monitor must be held.
|
||||
*/
|
||||
void UpdateStreamBlockingForStateMachinePlaying();
|
||||
|
||||
nsTArray<OutputStreamData>& OutputStreams()
|
||||
{
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
return mOutputStreams;
|
||||
return mDecodedStream.OutputStreams();
|
||||
}
|
||||
|
||||
DecodedStreamData* GetDecodedStream()
|
||||
|
@ -1031,8 +1032,6 @@ private:
|
|||
#endif
|
||||
|
||||
protected:
|
||||
// Data about MediaStreams that are being fed by this decoder.
|
||||
nsTArray<OutputStreamData> mOutputStreams;
|
||||
// The SourceMediaStream we are using to feed the mOutputStreams. This stream
|
||||
// is never exposed outside the decoder.
|
||||
// Only written on the main thread while holding the monitor. Therefore it
|
||||
|
|
|
@ -47,7 +47,7 @@ bool
|
|||
MediaOmxCommonDecoder::CheckDecoderCanOffloadAudio()
|
||||
{
|
||||
return (mCanOffloadAudio && !mFallbackToStateMachine &&
|
||||
!mOutputStreams.Length() && mPlaybackRate == 1.0);
|
||||
!OutputStreams().Length() && mPlaybackRate == 1.0);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче