зеркало из 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 "AudioNodeStream.h"
|
||||||
#include "AudioNodeExternalInputStream.h"
|
#include "AudioNodeExternalInputStream.h"
|
||||||
#include "MediaStreamListener.h"
|
#include "MediaStreamListener.h"
|
||||||
|
#include "MediaStreamVideoSink.h"
|
||||||
#include "mozilla/dom/AudioContextBinding.h"
|
#include "mozilla/dom/AudioContextBinding.h"
|
||||||
#include "mozilla/media/MediaUtils.h"
|
#include "mozilla/media/MediaUtils.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -2287,6 +2288,8 @@ MediaStream::AddVideoOutputImpl(already_AddRefed<MediaStreamVideoSink> aSink,
|
||||||
TrackBound<MediaStreamVideoSink>* l = mVideoOutputs.AppendElement();
|
TrackBound<MediaStreamVideoSink>* l = mVideoOutputs.AppendElement();
|
||||||
l->mListener = sink;
|
l->mListener = sink;
|
||||||
l->mTrackID = aID;
|
l->mTrackID = aID;
|
||||||
|
|
||||||
|
AddDirectTrackListenerImpl(sink.forget(), aID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2307,6 +2310,8 @@ MediaStream::RemoveVideoOutputImpl(MediaStreamVideoSink* aSink,
|
||||||
mVideoOutputs.RemoveElementAt(i);
|
mVideoOutputs.RemoveElementAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RemoveDirectTrackListenerImpl(aSink, aID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2969,6 +2974,15 @@ SourceMediaStream::AddDirectTrackListenerImpl(already_AddRefed<DirectMediaStream
|
||||||
isVideo = data->mData->GetType() == MediaSegment::VIDEO;
|
isVideo = data->mData->GetType() == MediaSegment::VIDEO;
|
||||||
}
|
}
|
||||||
if (found && (isAudio || isVideo)) {
|
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 =
|
TrackBound<DirectMediaStreamTrackListener>* sourceListener =
|
||||||
mDirectTrackListeners.AppendElement();
|
mDirectTrackListeners.AppendElement();
|
||||||
sourceListener->mListener = listener;
|
sourceListener->mListener = listener;
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace mozilla {
|
||||||
class AudioSegment;
|
class AudioSegment;
|
||||||
class MediaStream;
|
class MediaStream;
|
||||||
class MediaStreamGraph;
|
class MediaStreamGraph;
|
||||||
|
class MediaStreamVideoSink;
|
||||||
class VideoSegment;
|
class VideoSegment;
|
||||||
|
|
||||||
enum MediaStreamGraphEvent : uint32_t {
|
enum MediaStreamGraphEvent : uint32_t {
|
||||||
|
@ -245,6 +246,9 @@ public:
|
||||||
* STREAM_NOT_SUPPORTED
|
* STREAM_NOT_SUPPORTED
|
||||||
* While looking for the data source of this track, we found a MediaStream
|
* While looking for the data source of this track, we found a MediaStream
|
||||||
* that is not a SourceMediaStream or a TrackUnionStream.
|
* that is not a SourceMediaStream or a TrackUnionStream.
|
||||||
|
* ALREADY_EXIST
|
||||||
|
* This DirectMediaStreamTrackListener already exists in the
|
||||||
|
* SourceMediaStream.
|
||||||
* SUCCESS
|
* SUCCESS
|
||||||
* Installation was successful and this listener will start receiving
|
* Installation was successful and this listener will start receiving
|
||||||
* NotifyRealtimeData on the next AppendToTrack().
|
* NotifyRealtimeData on the next AppendToTrack().
|
||||||
|
@ -253,11 +257,14 @@ public:
|
||||||
TRACK_NOT_FOUND_AT_SOURCE,
|
TRACK_NOT_FOUND_AT_SOURCE,
|
||||||
TRACK_TYPE_NOT_SUPPORTED,
|
TRACK_TYPE_NOT_SUPPORTED,
|
||||||
STREAM_NOT_SUPPORTED,
|
STREAM_NOT_SUPPORTED,
|
||||||
|
ALREADY_EXISTS,
|
||||||
SUCCESS
|
SUCCESS
|
||||||
};
|
};
|
||||||
virtual void NotifyDirectListenerInstalled(InstallationResult aResult) {}
|
virtual void NotifyDirectListenerInstalled(InstallationResult aResult) {}
|
||||||
virtual void NotifyDirectListenerUninstalled() {}
|
virtual void NotifyDirectListenerUninstalled() {}
|
||||||
|
|
||||||
|
virtual MediaStreamVideoSink* AsMediaStreamVideoSink() { return nullptr; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~DirectMediaStreamTrackListener() {}
|
virtual ~DirectMediaStreamTrackListener() {}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ public:
|
||||||
virtual VideoFrameContainer* AsVideoFrameContainer() { return nullptr; }
|
virtual VideoFrameContainer* AsVideoFrameContainer() { return nullptr; }
|
||||||
virtual void Invalidate() {}
|
virtual void Invalidate() {}
|
||||||
|
|
||||||
|
virtual MediaStreamVideoSink* AsMediaStreamVideoSink() override { return this; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~MediaStreamVideoSink() {};
|
virtual ~MediaStreamVideoSink() {};
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче