Bug 1170958 - Add input stream and track as args to NotifyQueuedTrackChanges. r=roc

This allows for tracking the input track of an added track (for
ProcessedMediaStream tracks; SourceMediaStream tracks don't have input
tracks) directly in the NotifyQueuedTrackChanges handler, which will be
necessary for locking MediaInputPorts to specific tracks.

--HG--
extra : commitid : Kvj9RrN9MgP
This commit is contained in:
Andreas Pehrson 2015-09-25 23:23:17 +08:00
Родитель 89236a1856
Коммит 7aca9eb1fd
13 изменённых файлов: 55 добавлений и 17 удалений

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

@ -3053,7 +3053,9 @@ public:
virtual void NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID,
StreamTime aTrackOffset,
uint32_t aTrackEvents,
const MediaSegment& aQueuedMedia) override
const MediaSegment& aQueuedMedia,
MediaStream* aInputStream,
TrackID aInputTrackID) override
{
MutexAutoLock lock(mMutex);
if (mInitialSize != gfx::IntSize(0,0) ||

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

@ -41,8 +41,10 @@ public:
public:
TrackChange(StreamListener* aListener,
TrackID aID, StreamTime aTrackOffset,
uint32_t aEvents, MediaSegment::Type aType)
uint32_t aEvents, MediaSegment::Type aType,
MediaStream* aInputStream, TrackID aInputTrackID)
: mListener(aListener), mID(aID), mEvents(aEvents), mType(aType)
, mInputStream(aInputStream), mInputTrackID(aInputTrackID)
{
}
@ -82,6 +84,8 @@ public:
TrackID mID;
uint32_t mEvents;
MediaSegment::Type mType;
nsRefPtr<MediaStream> mInputStream;
TrackID mInputTrackID;
};
/**
@ -94,12 +98,14 @@ public:
virtual void NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID,
StreamTime aTrackOffset,
uint32_t aTrackEvents,
const MediaSegment& aQueuedMedia) override
const MediaSegment& aQueuedMedia,
MediaStream* aInputStream,
TrackID aInputTrackID) override
{
if (aTrackEvents & (TRACK_EVENT_CREATED | TRACK_EVENT_ENDED)) {
nsRefPtr<TrackChange> runnable =
new TrackChange(this, aID, aTrackOffset, aTrackEvents,
aQueuedMedia.GetType());
aQueuedMedia.GetType(), aInputStream, aInputTrackID);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(runnable.forget());
}
}

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

@ -161,11 +161,16 @@ public:
* aTrackEvents can be any combination of TRACK_EVENT_CREATED and
* TRACK_EVENT_ENDED. aQueuedMedia is the data being added to the track
* at aTrackOffset (relative to the start of the stream).
* aInputStream and aInputTrackID will be set if the changes originated
* from an input stream's track. In practice they will only be used for
* ProcessedMediaStreams.
*/
virtual void NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID,
StreamTime aTrackOffset,
uint32_t aTrackEvents,
const MediaSegment& aQueuedMedia) {}
const MediaSegment& aQueuedMedia,
MediaStream* aInputStream = nullptr,
TrackID aInputTrackID = TRACK_INVALID) {}
/**
* Notify that all new tracks this iteration have been created.

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

@ -41,7 +41,9 @@ MediaEncoder::NotifyQueuedTrackChanges(MediaStreamGraph* aGraph,
TrackID aID,
StreamTime aTrackOffset,
uint32_t aTrackEvents,
const MediaSegment& aQueuedMedia)
const MediaSegment& aQueuedMedia,
MediaStream* aInputStream,
TrackID aInputTrackID)
{
// Process the incoming raw track data from MediaStreamGraph, called on the
// thread of MediaStreamGraph.

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

@ -85,7 +85,9 @@ public :
virtual void NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID,
StreamTime aTrackOffset,
uint32_t aTrackEvents,
const MediaSegment& aQueuedMedia) override;
const MediaSegment& aQueuedMedia,
MediaStream* aInputStream,
TrackID aInputTrackID) override;
/**
* Notified the stream is being removed.

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

@ -86,7 +86,9 @@ void
CaptureTask::NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID,
StreamTime aTrackOffset,
uint32_t aTrackEvents,
const MediaSegment& aQueuedMedia)
const MediaSegment& aQueuedMedia,
MediaStream* aInputStream,
TrackID aInputTrackID)
{
if (mImageGrabbedOrTrackEnd) {
return;

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

@ -35,7 +35,9 @@ public:
virtual void NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID,
StreamTime aTrackOffset,
uint32_t aTrackEvents,
const MediaSegment& aQueuedMedia) override;
const MediaSegment& aQueuedMedia,
MediaStream* aInputStream,
TrackID aInputTrackID) override;
virtual void NotifyEvent(MediaStreamGraph* aGraph,
MediaStreamGraphEvent aEvent) override;

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

@ -33,7 +33,9 @@ SpeechStreamListener::NotifyQueuedTrackChanges(MediaStreamGraph* aGraph,
TrackID aID,
StreamTime aTrackOffset,
uint32_t aTrackEvents,
const MediaSegment& aQueuedMedia)
const MediaSegment& aQueuedMedia,
MediaStream* aInputStream,
TrackID aInputTrackID)
{
AudioSegment* audio = const_cast<AudioSegment*>(
static_cast<const AudioSegment*>(&aQueuedMedia));

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

@ -27,7 +27,9 @@ public:
virtual void NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID,
StreamTime aTrackOffset,
uint32_t aTrackEvents,
const MediaSegment& aQueuedMedia) override;
const MediaSegment& aQueuedMedia,
MediaStream* aInputStream,
TrackID aInputTrackID) override;
virtual void NotifyEvent(MediaStreamGraph* aGraph,
MediaStreamListener::MediaStreamGraphEvent event) override;

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

@ -868,7 +868,9 @@ void MediaPipelineTransmit::PipelineListener::
NotifyQueuedTrackChanges(MediaStreamGraph* graph, TrackID tid,
StreamTime offset,
uint32_t events,
const MediaSegment& queued_media) {
const MediaSegment& queued_media,
MediaStream* aInputStream,
TrackID aInputTrackID) {
MOZ_MTLOG(ML_DEBUG, "MediaPipeline::NotifyQueuedTrackChanges()");
// ignore non-direct data if we're also getting direct data

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

@ -482,7 +482,9 @@ public:
virtual void NotifyQueuedTrackChanges(MediaStreamGraph* graph, TrackID tid,
StreamTime offset,
uint32_t events,
const MediaSegment& queued_media) override;
const MediaSegment& queued_media,
MediaStream* input_stream,
TrackID input_tid) override;
virtual void NotifyPull(MediaStreamGraph* aGraph, StreamTime aDesiredTime) override {}
// Implement MediaStreamDirectListener
@ -629,7 +631,9 @@ class MediaPipelineReceiveAudio : public MediaPipelineReceive {
virtual void NotifyQueuedTrackChanges(MediaStreamGraph* graph, TrackID tid,
StreamTime offset,
uint32_t events,
const MediaSegment& queued_media) override {}
const MediaSegment& queued_media,
MediaStream* input_stream,
TrackID input_tid) override {}
virtual void NotifyPull(MediaStreamGraph* graph, StreamTime desired_time) override;
private:
@ -725,7 +729,9 @@ class MediaPipelineReceiveVideo : public MediaPipelineReceive {
virtual void NotifyQueuedTrackChanges(MediaStreamGraph* graph, TrackID tid,
StreamTime offset,
uint32_t events,
const MediaSegment& queued_media) override {}
const MediaSegment& queued_media,
MediaStream* input_stream,
TrackID input_tid) override {}
virtual void NotifyPull(MediaStreamGraph* graph, StreamTime desired_time) override;
// Accessors for external writes from the renderer

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

@ -74,6 +74,7 @@ protected:
virtual ~Fake_VideoSink() {}
};
class Fake_MediaStream;
class Fake_SourceMediaStream;
class Fake_MediaStreamListener
@ -85,7 +86,9 @@ public:
virtual void NotifyQueuedTrackChanges(mozilla::MediaStreamGraph* aGraph, mozilla::TrackID aID,
mozilla::StreamTime aTrackOffset,
uint32_t aTrackEvents,
const mozilla::MediaSegment& aQueuedMedia) = 0;
const mozilla::MediaSegment& aQueuedMedia,
Fake_MediaStream* aInputStream,
mozilla::TrackID aInputTrackID) = 0;
virtual void NotifyPull(mozilla::MediaStreamGraph* aGraph, mozilla::StreamTime aDesiredTime) = 0;
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Fake_MediaStreamListener)

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

@ -116,7 +116,9 @@ void Fake_AudioStreamSource::Periodic() {
0, // TrackID
0, // Offset TODO(ekr@rtfm.com) fix
0, // ???
segment);
segment,
nullptr, // Input stream
-1); // Input track id
}
}