зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1201363 - Register MediaStreamVideoSink into SourceMediaStream. r=jesup
MozReview-Commit-ID: 7X546VXVLJT --HG-- extra : transplant_source : z%E8%25E%07%AA%08%B1%EC%D83LQ%FE%0A%05%D0%9E%85%B6
This commit is contained in:
Родитель
150ab2d45b
Коммит
a81c3ec430
|
@ -23,6 +23,7 @@
|
|||
#include "AudioNodeStream.h"
|
||||
#include "AudioNodeExternalInputStream.h"
|
||||
#include "MediaStreamListener.h"
|
||||
#include "MediaStreamVideoSink.h"
|
||||
#include "mozilla/dom/AudioContextBinding.h"
|
||||
#include "mozilla/media/MediaUtils.h"
|
||||
#include <algorithm>
|
||||
|
@ -2287,6 +2288,8 @@ MediaStream::AddVideoOutputImpl(already_AddRefed<MediaStreamVideoSink> aSink,
|
|||
TrackBound<MediaStreamVideoSink>* l = mVideoOutputs.AppendElement();
|
||||
l->mListener = sink;
|
||||
l->mTrackID = aID;
|
||||
|
||||
AddDirectTrackListenerImpl(sink.forget(), aID);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2307,6 +2310,8 @@ MediaStream::RemoveVideoOutputImpl(MediaStreamVideoSink* aSink,
|
|||
mVideoOutputs.RemoveElementAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
RemoveDirectTrackListenerImpl(aSink, aID);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2969,6 +2974,15 @@ SourceMediaStream::AddDirectTrackListenerImpl(already_AddRefed<DirectMediaStream
|
|||
isVideo = data->mData->GetType() == MediaSegment::VIDEO;
|
||||
}
|
||||
if (found && (isAudio || isVideo)) {
|
||||
for (auto entry : mDirectTrackListeners) {
|
||||
if (entry.mListener == listener &&
|
||||
(entry.mTrackID == TRACK_ANY || entry.mTrackID == aTrackID)) {
|
||||
listener->NotifyDirectListenerInstalled(
|
||||
DirectMediaStreamTrackListener::InstallationResult::ALREADY_EXISTS);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
TrackBound<DirectMediaStreamTrackListener>* sourceListener =
|
||||
mDirectTrackListeners.AppendElement();
|
||||
sourceListener->mListener = listener;
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace mozilla {
|
|||
class AudioSegment;
|
||||
class MediaStream;
|
||||
class MediaStreamGraph;
|
||||
class MediaStreamVideoSink;
|
||||
class VideoSegment;
|
||||
|
||||
enum MediaStreamGraphEvent : uint32_t {
|
||||
|
@ -245,6 +246,9 @@ public:
|
|||
* STREAM_NOT_SUPPORTED
|
||||
* While looking for the data source of this track, we found a MediaStream
|
||||
* that is not a SourceMediaStream or a TrackUnionStream.
|
||||
* ALREADY_EXIST
|
||||
* This DirectMediaStreamTrackListener already exists in the
|
||||
* SourceMediaStream.
|
||||
* SUCCESS
|
||||
* Installation was successful and this listener will start receiving
|
||||
* NotifyRealtimeData on the next AppendToTrack().
|
||||
|
@ -253,11 +257,14 @@ public:
|
|||
TRACK_NOT_FOUND_AT_SOURCE,
|
||||
TRACK_TYPE_NOT_SUPPORTED,
|
||||
STREAM_NOT_SUPPORTED,
|
||||
ALREADY_EXISTS,
|
||||
SUCCESS
|
||||
};
|
||||
virtual void NotifyDirectListenerInstalled(InstallationResult aResult) {}
|
||||
virtual void NotifyDirectListenerUninstalled() {}
|
||||
|
||||
virtual MediaStreamVideoSink* AsMediaStreamVideoSink() { return nullptr; }
|
||||
|
||||
protected:
|
||||
virtual ~DirectMediaStreamTrackListener() {}
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ public:
|
|||
virtual VideoFrameContainer* AsVideoFrameContainer() { return nullptr; }
|
||||
virtual void Invalidate() {}
|
||||
|
||||
virtual MediaStreamVideoSink* AsMediaStreamVideoSink() override { return this; }
|
||||
|
||||
protected:
|
||||
virtual ~MediaStreamVideoSink() {};
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче