Bug 1319446 - DirectMediaStreamListener, you are dead to me. r=padenot

MozReview-Commit-ID: KwztE5ogSj9

--HG--
extra : rebase_source : e8e6bb3548c5697c5db901c0310ea5067a30c895
This commit is contained in:
Andreas Pehrson 2017-09-27 12:01:46 +02:00
parent d1baf4caa2
commit d918302551
14 changed files with 0 additions and 149 deletions

View File

@ -841,24 +841,6 @@ DOMMediaStream::OwnsTrack(const MediaStreamTrack& aTrack) const
return !!FindOwnedTrackPort(aTrack);
}
bool
DOMMediaStream::AddDirectListener(DirectMediaStreamListener* aListener)
{
if (GetInputStream() && GetInputStream()->AsSourceStream()) {
GetInputStream()->AsSourceStream()->AddDirectListener(aListener);
return true; // application should ignore NotifyQueuedTrackData
}
return false;
}
void
DOMMediaStream::RemoveDirectListener(DirectMediaStreamListener* aListener)
{
if (GetInputStream() && GetInputStream()->AsSourceStream()) {
GetInputStream()->AsSourceStream()->RemoveDirectListener(aListener);
}
}
bool
DOMMediaStream::IsFinished() const
{

View File

@ -31,7 +31,6 @@ class DOMLocalMediaStream;
class DOMMediaStream;
class MediaStream;
class MediaInputPort;
class DirectMediaStreamListener;
class MediaStreamGraph;
class ProcessedMediaStream;
@ -447,13 +446,6 @@ public:
*/
virtual MediaStream* GetCameraStream() const { return nullptr; }
/**
* Allows users to get access to media data without going through graph
* queuing. Returns a bool to let us know if direct data will be delivered.
*/
bool AddDirectListener(DirectMediaStreamListener *aListener);
void RemoveDirectListener(DirectMediaStreamListener *aListener);
/**
* Legacy method that returns true when the playback stream has finished.
*/

View File

@ -235,8 +235,6 @@ public:
*/
void NotifyRemoved();
void NotifyDirectListeners(MediaStreamGraph* aGraph, bool aHasListeners);
bool Activated() const
{
return mActivated;
@ -3824,12 +3822,6 @@ SourceListener::NotifyEvent(MediaStreamGraph* aGraph,
&SourceListener::NotifyRemoved),
NS_DISPATCH_NORMAL);
break;
case MediaStreamGraphEvent::EVENT_HAS_DIRECT_LISTENERS:
NotifyDirectListeners(aGraph, true);
break;
case MediaStreamGraphEvent::EVENT_HAS_NO_DIRECT_LISTENERS:
NotifyDirectListeners(aGraph, false);
break;
default:
break;
}
@ -3865,21 +3857,6 @@ SourceListener::NotifyRemoved()
mWindowListener = nullptr;
}
void
SourceListener::NotifyDirectListeners(MediaStreamGraph* aGraph,
bool aHasListeners)
{
if (!mVideoDevice) {
return;
}
auto& videoDevice = mVideoDevice;
MediaManager::PostTask(NewTaskFrom([videoDevice, aHasListeners]() {
videoDevice->GetSource()->SetDirectListeners(aHasListeners);
return NS_OK;
}));
}
bool
SourceListener::CapturingVideo() const
{

View File

@ -2893,13 +2893,6 @@ SourceMediaStream::NotifyDirectConsumers(TrackData *aTrack,
mMutex.AssertCurrentThreadOwns();
MOZ_ASSERT(aTrack);
for (uint32_t j = 0; j < mDirectListeners.Length(); ++j) {
DirectMediaStreamListener* l = mDirectListeners[j];
StreamTime offset = 0; // FIX! need a separate StreamTime.... or the end of the internal buffer
l->NotifyRealtimeData(static_cast<MediaStreamGraph*>(GraphImpl()), aTrack->mID,
offset, aTrack->mCommands, *aSegment);
}
for (const TrackBound<DirectMediaStreamTrackListener>& source
: mDirectTrackListeners) {
if (aTrack->mID != source.mTrackID) {
@ -2936,38 +2929,6 @@ SourceMediaStream::NotifyListenersEvent(MediaStreamGraphEvent aNewEvent)
GraphImpl()->AppendMessage(MakeUnique<Message>(this, aNewEvent));
}
void
SourceMediaStream::AddDirectListener(DirectMediaStreamListener* aListener)
{
bool wasEmpty;
{
MutexAutoLock lock(mMutex);
wasEmpty = mDirectListeners.IsEmpty();
mDirectListeners.AppendElement(aListener);
}
if (wasEmpty) {
// Async
NotifyListenersEvent(MediaStreamGraphEvent::EVENT_HAS_DIRECT_LISTENERS);
}
}
void
SourceMediaStream::RemoveDirectListener(DirectMediaStreamListener* aListener)
{
bool isEmpty;
{
MutexAutoLock lock(mMutex);
mDirectListeners.RemoveElement(aListener);
isEmpty = mDirectListeners.IsEmpty();
}
if (isEmpty) {
// Async
NotifyListenersEvent(MediaStreamGraphEvent::EVENT_HAS_NO_DIRECT_LISTENERS);
}
}
void
SourceMediaStream::AddDirectTrackListenerImpl(already_AddRefed<DirectMediaStreamTrackListener> aListener,
TrackID aTrackID)

View File

@ -157,7 +157,6 @@ class AudioNodeEngine;
class AudioNodeExternalInputStream;
class AudioNodeStream;
class AudioSegment;
class DirectMediaStreamListener;
class DirectMediaStreamTrackListener;
class MediaInputPort;
class MediaStreamGraphImpl;
@ -703,8 +702,6 @@ public:
*/
void NotifyListenersEventImpl(MediaStreamGraphEvent aEvent);
void NotifyListenersEvent(MediaStreamGraphEvent aEvent);
void AddDirectListener(DirectMediaStreamListener* aListener);
void RemoveDirectListener(DirectMediaStreamListener* aListener);
enum {
ADDTRACK_QUEUED = 0x01 // Queue track add until FinishAddTracks()
@ -893,7 +890,6 @@ protected:
TimeStamp mStreamTracksStartTimeStamp;
nsTArray<TrackData> mUpdateTracks;
nsTArray<TrackData> mPendingTracks;
nsTArray<RefPtr<DirectMediaStreamListener>> mDirectListeners;
nsTArray<TrackBound<DirectMediaStreamTrackListener>> mDirectTrackListeners;
bool mPullEnabled;
bool mUpdateFinished;

View File

@ -162,30 +162,6 @@ protected:
virtual ~MediaStreamTrackListener() {}
};
/**
* This is a base class for media graph thread listener direct callbacks
* from within AppendToTrack(). Note that your regular listener will
* still get NotifyQueuedTrackChanges() callbacks from the MSG thread, so
* you must be careful to ignore them if AddDirectListener was successful.
*/
class DirectMediaStreamListener : public MediaStreamListener
{
public:
virtual ~DirectMediaStreamListener() {}
/*
* This will be called on any DirectMediaStreamListener added to a
* a SourceMediaStream when AppendToTrack() is called. The MediaSegment
* will be the RawSegment (unresampled) if available in AppendToTrack().
* Note that NotifyQueuedTrackChanges() calls will also still occur.
*/
virtual void NotifyRealtimeData(MediaStreamGraph* aGraph, TrackID aID,
StreamTime aTrackOffset,
uint32_t aTrackEvents,
const MediaSegment& aMedia) {}
};
/**
* This is a base class for media graph thread listener direct callbacks from
* within AppendToTrack(). It is bound to a certain track and can only be

View File

@ -14,8 +14,6 @@ namespace mozilla {
enum MediaStreamGraphEvent : uint32_t {
EVENT_FINISHED,
EVENT_REMOVED,
EVENT_HAS_DIRECT_LISTENERS, // transition from no direct listeners
EVENT_HAS_NO_DIRECT_LISTENERS, // transition to no direct listeners
};
// maskable flags, not a simple enumerated value

View File

@ -275,9 +275,6 @@ public:
* immediately after. */
virtual nsresult Start(SourceMediaStream*, TrackID, const PrincipalHandle&) = 0;
/* tell the source if there are any direct listeners attached */
virtual void SetDirectListeners(bool) = 0;
/* Called when the stream wants more data */
virtual void NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream *aSource,

View File

@ -401,11 +401,4 @@ MediaEngineCameraVideoSource::GetUUID() const
return mUniqueId;
}
void
MediaEngineCameraVideoSource::SetDirectListeners(bool aHasDirectListeners)
{
LOG((__FUNCTION__));
mHasDirectListeners = aHasDirectListeners;
}
} // namespace mozilla

View File

@ -35,7 +35,6 @@ public:
, mWidth(0)
, mHeight(0)
, mInitDone(false)
, mHasDirectListeners(false)
, mCaptureIndex(aIndex)
, mTrackID(0)
{}
@ -45,7 +44,6 @@ public:
void GetName(nsAString& aName) const override;
void GetUUID(nsACString& aUUID) const override;
void SetDirectListeners(bool aHasListeners) override;
bool IsFake() override
{
@ -123,7 +121,6 @@ protected:
int mWidth, mHeight;
bool mInitDone;
bool mHasDirectListeners;
int mCaptureIndex;
TrackID mTrackID;

View File

@ -65,7 +65,6 @@ public:
const MediaEnginePrefs &aPrefs,
const nsString& aDeviceId,
const char** aOutBadConstraint) override;
void SetDirectListeners(bool aHasDirectListeners) override {};
void NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream *aSource,
TrackID aId,
@ -145,7 +144,6 @@ public:
const MediaEnginePrefs &aPrefs,
const nsString& aDeviceId,
const char** aOutBadConstraint) override;
void SetDirectListeners(bool aHasDirectListeners) override {};
void inline AppendToSegment(AudioSegment& aSegment,
TrackTicks aSamples,
const PrincipalHandle& aPrincipalHandle);

View File

@ -34,7 +34,6 @@ class MediaEngineTabVideoSource : public MediaEngineVideoSource, nsIDOMEventList
const char** aOutBadConstraint) override;
nsresult Deallocate(AllocationHandle* aHandle) override;
nsresult Start(mozilla::SourceMediaStream*, mozilla::TrackID, const mozilla::PrincipalHandle&) override;
void SetDirectListeners(bool aHasDirectListeners) override {};
void NotifyPull(mozilla::MediaStreamGraph*, mozilla::SourceMediaStream*, mozilla::TrackID, mozilla::StreamTime, const mozilla::PrincipalHandle& aPrincipalHandle) override;
nsresult Stop(mozilla::SourceMediaStream*, mozilla::TrackID) override;
nsresult Restart(AllocationHandle* aHandle,

View File

@ -100,8 +100,6 @@ public:
const MediaEnginePrefs &aPrefs,
const nsString& aDeviceId,
const char** aOutBadConstraint) override;
void SetDirectListeners(bool aDirect) override
{}
void NotifyOutputData(MediaStreamGraph* aGraph,
AudioDataValue* aBuffer, size_t aFrames,
TrackRate aRate, uint32_t aChannels) override
@ -516,7 +514,6 @@ public:
const MediaEnginePrefs &aPrefs,
const nsString& aDeviceId,
const char** aOutBadConstraint) override;
void SetDirectListeners(bool aHasDirectListeners) override {};
void NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream* aSource,

View File

@ -110,17 +110,6 @@ public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Fake_MediaStreamListener)
};
class Fake_DirectMediaStreamListener : public Fake_MediaStreamListener
{
protected:
virtual ~Fake_DirectMediaStreamListener() {}
public:
virtual void NotifyRealtimeData(mozilla::MediaStreamGraph* graph, mozilla::TrackID tid,
mozilla::StreamTime offset,
const mozilla::MediaSegment& media) = 0;
};
class Fake_MediaStreamTrackListener
{
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Fake_MediaStreamTrackListener)
@ -653,7 +642,6 @@ namespace mozilla {
typedef Fake_MediaStream MediaStream;
typedef Fake_SourceMediaStream SourceMediaStream;
typedef Fake_MediaStreamListener MediaStreamListener;
typedef Fake_DirectMediaStreamListener DirectMediaStreamListener;
typedef Fake_MediaStreamTrackListener MediaStreamTrackListener;
typedef Fake_DirectMediaStreamTrackListener DirectMediaStreamTrackListener;
typedef Fake_DOMMediaStream DOMMediaStream;