Backed out 2 changesets (bug 909187)

Backed out changeset 79b1a4a62635 (bug 909187)
Backed out changeset 0601038e2a31 (bug 909187)
This commit is contained in:
Wes Kocher 2013-08-26 02:29:55 -07:00
Родитель f8b0a1ad88
Коммит 30bb9083ce
9 изменённых файлов: 24 добавлений и 78 удалений

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

@ -240,14 +240,6 @@ DOMMediaStream::CreateTrackUnionStream(nsIDOMWindow* aWindow, TrackTypeHints aHi
return stream.forget();
}
void
DOMMediaStream::SetTrackEnabled(TrackID aTrackID, bool aEnabled)
{
if (mStream) {
mStream->SetTrackEnabled(aTrackID, aEnabled);
}
}
bool
DOMMediaStream::CombineWithPrincipal(nsIPrincipal* aPrincipal)
{

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

@ -84,12 +84,6 @@ public:
virtual bool AddDirectListener(MediaStreamDirectListener *aListener) { return false; }
virtual void RemoveDirectListener(MediaStreamDirectListener *aListener) {}
/**
* Overridden in DOMLocalMediaStreams to allow getUserMedia to disable
* media at the SourceMediaStream.
*/
virtual void SetTrackEnabled(TrackID aTrackID, bool aEnabled);
bool IsFinished();
/**
* Returns a principal indicating who may access this stream. The stream contents

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

@ -100,10 +100,6 @@ public:
* Insert aDuration of null data at the end of the segment.
*/
virtual void AppendNullData(TrackTicks aDuration) = 0;
/**
* Replace contents with disabled data of the same duration
*/
virtual void ReplaceWithDisabled() = 0;
/**
* Remove all contents, setting duration to 0.
*/
@ -194,15 +190,6 @@ public:
}
mDuration += aDuration;
}
virtual void ReplaceWithDisabled()
{
if (GetType() != AUDIO) {
MOZ_CRASH("Disabling unknown segment type");
}
TrackTicks duration = GetDuration();
Clear();
AppendNullData(duration);
}
virtual void Clear()
{
mDuration = 0;

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

@ -1912,15 +1912,29 @@ MediaStream::SetTrackEnabled(TrackID aTrackID, bool aEnabled)
}
void
MediaStream::ApplyTrackDisabling(TrackID aTrackID, MediaSegment* aSegment, MediaSegment* aRawSegment)
MediaStream::ApplyTrackDisabling(TrackID aTrackID, MediaSegment* aSegment)
{
// mMutex must be owned here if this is a SourceMediaStream
if (!mDisabledTrackIDs.Contains(aTrackID)) {
return;
}
aSegment->ReplaceWithDisabled();
if (aRawSegment) {
aRawSegment->ReplaceWithDisabled();
switch (aSegment->GetType()) {
case MediaSegment::AUDIO: {
TrackTicks duration = aSegment->GetDuration();
aSegment->Clear();
aSegment->AppendNullData(duration);
break;
}
case MediaSegment::VIDEO: {
for (VideoSegment::ChunkIterator i(*static_cast<VideoSegment*>(aSegment));
!i.IsEnded(); i.Next()) {
VideoChunk& chunk = *i;
chunk.SetForceBlack(true);
}
break;
}
default:
MOZ_CRASH("Unknown track type");
}
}
@ -1976,10 +1990,6 @@ SourceMediaStream::AppendToTrack(TrackID aID, MediaSegment* aSegment, MediaSegme
// Indirect listeners (via subsequent TrackUnion nodes) are synced to
// playout time, and so can be delayed by buffering.
// Apply track disabling before notifying any consumers directly
// or inserting into the graph
ApplyTrackDisabling(aID, aSegment, aRawSegment);
// Must notify first, since AppendFrom() will empty out aSegment
NotifyDirectConsumers(track, aRawSegment ? aRawSegment : aSegment);
track->mData->AppendFrom(aSegment); // note: aSegment is now dead

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

@ -459,7 +459,7 @@ public:
StreamBuffer::Track* EnsureTrack(TrackID aTrack, TrackRate aSampleRate);
void ApplyTrackDisabling(TrackID aTrackID, MediaSegment* aSegment, MediaSegment* aRawSegment = nullptr);
void ApplyTrackDisabling(TrackID aTrackID, MediaSegment* aSegment);
DOMMediaStream* GetWrapper()
{
@ -679,11 +679,6 @@ public:
FinishWithLockHeld();
}
// Overriding allows us to hold the mMutex lock while changing the track enable status
void SetTrackEnabledImpl(TrackID aTrackID, bool aEnabled) {
MutexAutoLock lock(mMutex);
MediaStream::SetTrackEnabledImpl(aTrackID, aEnabled);
}
/**
* End all tracks and Finish() this stream. Used to voluntarily revoke access
@ -942,11 +937,6 @@ public:
virtual void ProduceOutput(GraphTime aFrom, GraphTime aTo) = 0;
void SetAutofinishImpl(bool aAutofinish) { mAutofinish = aAutofinish; }
/**
* Forward SetTrackEnabled() to the input MediaStream(s) and translate the ID
*/
virtual void ForwardTrackEnabled(TrackID aOutputID, bool aEnabled) {};
protected:
// This state is all accessed only on the media graph thread.

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

@ -52,7 +52,10 @@ void
MediaStreamTrack::SetEnabled(bool aEnabled)
{
mEnabled = aEnabled;
mStream->SetTrackEnabled(mTrackID, aEnabled);
MediaStream* stream = mStream->GetStream();
if (stream) {
stream->SetTrackEnabled(mTrackID, aEnabled);
}
}
}

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

@ -115,17 +115,6 @@ public:
mFilterCallback = aCallback;
}
// Forward SetTrackEnabled(output_track_id, enabled) to the Source MediaStream,
// translating the output track ID into the correct ID in the source.
virtual void ForwardTrackEnabled(TrackID aOutputID, bool aEnabled) {
for (int32_t i = mTrackMap.Length() - 1; i >= 0; --i) {
if (mTrackMap[i].mOutputTrackID == aOutputID) {
mTrackMap[i].mInputPort->GetSource()->
SetTrackEnabled(mTrackMap[i].mInputTrackID, aEnabled);
}
}
}
protected:
TrackIDFilterCallback mFilterCallback;

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

@ -107,14 +107,6 @@ public:
}
return &c->mFrame;
}
// Override default impl
virtual void ReplaceWithDisabled() MOZ_OVERRIDE {
for (ChunkIterator i(*this);
!i.IsEnded(); i.Next()) {
VideoChunk& chunk = *i;
chunk.SetForceBlack(true);
}
}
// Segment-generic methods not in MediaSegmentBase
static Type StaticType() { return VIDEO; }

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

@ -312,17 +312,6 @@ public:
}
}
// let us intervene for direct listeners when someone does track.enabled = false
virtual void SetTrackEnabled(TrackID aID, bool aEnabled) MOZ_OVERRIDE
{
// We encapsulate the SourceMediaStream and TrackUnion into one entity, so
// we can handle the disabling at the SourceMediaStream
// We need to find the input track ID for output ID aID, so we let the TrackUnion
// forward the request to the source and translate the ID
GetStream()->AsProcessedStream()->ForwardTrackEnabled(aID, aEnabled);
}
// The actual MediaStream is a TrackUnionStream. But these resources need to be
// explicitly destroyed too.
nsRefPtr<SourceMediaStream> mSourceStream;