Bug 1509548 - Remove the concept of a known tracks time from MediaStreamGraph. r=padenot

Differential Revision: https://phabricator.services.mozilla.com/D12923

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2018-11-29 17:37:06 +00:00
Родитель 83cea4adb0
Коммит a02fa011f0
12 изменённых файлов: 6 добавлений и 66 удалений

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

@ -108,9 +108,6 @@ void AudioCaptureStream::ProcessInput(GraphTime aFrom, GraphTime aTo,
// This calls MixerCallback below
mMixer.FinishMixing();
}
// Regardless of the status of the input tracks, we go foward.
mTracks.AdvanceKnownTracksTime(GraphTimeToStreamTimeWithBlocking((aTo)));
}
void AudioCaptureStream::MixerCallback(AudioDataValue* aMixedBuffer,

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

@ -115,7 +115,6 @@ OutputStreamDriver::OutputStreamDriver(SourceMediaStream* aSourceStream,
MOZ_ASSERT(mSourceStream);
mSourceStream->AddTrack(aTrackId, new VideoSegment());
mSourceStream->AddTrackListener(mTrackListener, aTrackId);
mSourceStream->AdvanceKnownTracksTime(STREAM_TIME_MAX);
mSourceStream->SetPullEnabled(true);
// All CanvasCaptureMediaStreams shall at least get one frame.

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

@ -4194,7 +4194,6 @@ RefPtr<SourceListener::InitPromise> SourceListener::InitializeAsync() {
// Start() queued the tracks to be added synchronously to avoid races
stream->FinishAddTracks();
stream->AdvanceKnownTracksTime(STREAM_TIME_MAX);
LOG(("started all sources"));
aHolder.Resolve(true, __func__);

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

@ -1964,7 +1964,6 @@ void MediaStream::FinishOnGraphThread() {
}
#endif
mFinished = true;
mTracks.AdvanceKnownTracksTime(STREAM_TIME_MAX);
// Let the MSG knows that this stream can be destroyed if necessary to avoid
// unnecessarily processing it in the future.
@ -2460,7 +2459,6 @@ void MediaStream::AddMainThreadListener(
SourceMediaStream::SourceMediaStream()
: MediaStream(),
mMutex("mozilla::media::SourceMediaStream"),
mUpdateKnownTracksTime(0),
mPullEnabled(false),
mFinishPending(false) {}
@ -2602,9 +2600,6 @@ void SourceMediaStream::ExtractPendingInput(GraphTime aCurrentTime) {
mUpdateTracks.RemoveElementAt(i);
}
}
if (!mFinished) {
mTracks.AdvanceKnownTracksTime(mUpdateKnownTracksTime);
}
if (mTracks.GetEnd() > 0) {
mHasCurrentData = true;
@ -2846,15 +2841,6 @@ void SourceMediaStream::EndTrack(TrackID aID) {
}
}
void SourceMediaStream::AdvanceKnownTracksTime(StreamTime aKnownTime) {
MutexAutoLock lock(mMutex);
MOZ_ASSERT(aKnownTime >= mUpdateKnownTracksTime);
mUpdateKnownTracksTime = aKnownTime;
if (auto graph = GraphImpl()) {
graph->EnsureNextIteration();
}
}
void SourceMediaStream::FinishPendingWithLockHeld() {
mMutex.AssertCurrentThreadOwns();
mFinishPending = true;

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

@ -698,9 +698,8 @@ class SourceMediaStream : public MediaStream {
ADDTRACK_QUEUED = 0x01 // Queue track add until FinishAddTracks()
};
/**
* Add a new track to the stream starting at the stream's current time
* (which must be greater than or equal to the last time passed to
* AdvanceKnownTracksTime). Takes ownership of aSegment.
* Add a new track to the stream starting at the stream's current time.
* Takes ownership of aSegment.
*/
void AddTrack(TrackID aID, MediaSegment* aSegment, uint32_t aFlags = 0) {
AddTrackInternal(aID, GraphRate(), aSegment, aFlags);
@ -739,12 +738,6 @@ class SourceMediaStream : public MediaStream {
* Ignored if the track does not exist.
*/
void EndTrack(TrackID aID);
/**
* Indicate that no tracks will be added starting before time aKnownTime.
* aKnownTime must be >= its value at the last call to AdvanceKnownTracksTime.
*/
void AdvanceKnownTracksTime(StreamTime aKnownTime);
void AdvanceKnownTracksTimeWithLockHeld(StreamTime aKnownTime);
/**
* Indicate that this stream should enter the "finished" state. All tracks
* must have been ended via EndTrack. The finish time of the stream is
@ -867,7 +860,6 @@ class SourceMediaStream : public MediaStream {
// held together.
Mutex mMutex;
// protected by mMutex
StreamTime mUpdateKnownTracksTime;
// This time stamp will be updated in adding and blocked SourceMediaStream,
// |AddStreamGraphThread| and |AdvanceTimeVaryingValuesToCurrentTime| in
// particularly.

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

@ -15,8 +15,7 @@ extern LazyLogModule gMediaStreamGraphLog;
#define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg)
void StreamTracks::DumpTrackInfo() const {
STREAM_LOG(LogLevel::Info,
("DumpTracks: mTracksKnownTime %" PRId64, mTracksKnownTime));
STREAM_LOG(LogLevel::Info, ("Dumping StreamTracks"));
for (uint32_t i = 0; i < mTracks.Length(); ++i) {
Track* track = mTracks[i];
if (track->IsEnded()) {

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

@ -144,7 +144,6 @@ class StreamTracks {
StreamTracks()
: mGraphRate(0),
mTracksKnownTime(0),
mForgottenTime(0),
mTracksDirty(false)
#ifdef DEBUG
@ -194,23 +193,9 @@ class StreamTracks {
mTracks.InsertElementSorted(track, CompareTracksByID());
mTracksDirty = true;
if (mTracksKnownTime == STREAM_TIME_MAX) {
// There exists code like
// http://mxr.mozilla.org/mozilla-central/source/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp?rev=96b197deb91e&mark=1292-1297#1292
NS_WARNING(
"Adding track to StreamTracks that should have no more tracks");
} else {
// NS_ASSERTION(mTracksKnownTime <= aStart, "Start time too early");
}
return *track;
}
void AdvanceKnownTracksTime(StreamTime aKnownTime) {
NS_ASSERTION(aKnownTime >= mTracksKnownTime,
"Can't move tracks-known time earlier");
mTracksKnownTime = aKnownTime;
}
/**
* The end time for the StreamTracks is the latest time for which we have
* data for all tracks that haven't ended by that time.
@ -218,9 +203,9 @@ class StreamTracks {
StreamTime GetEnd() const;
/**
* Returns the earliest time >= 0 at which all tracks have ended
* and all their data has been played out and no new tracks can be added,
* or STREAM_TIME_MAX if there is no such time.
* Returns the earliest time >= 0 at which all tracks have ended and all
* their data has been played out, or STREAM_TIME_MAX if there is no such
* time.
*/
StreamTime GetAllTracksEnd() const;
@ -299,9 +284,6 @@ class StreamTracks {
protected:
TrackRate mGraphRate; // StreamTime per second
// Any new tracks added will start at or after this time. In other words, the
// track list is complete and correct for all times less than this time.
StreamTime mTracksKnownTime;
StreamTime mForgottenTime;
private:

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

@ -143,8 +143,6 @@ void TrackUnionStream::ProcessInput(GraphTime aFrom, GraphTime aTo,
// all our tracks have actually finished and been removed from our map,
// so we're finished now.
FinishOnGraphThread();
} else {
mTracks.AdvanceKnownTracksTime(GraphTimeToStreamTimeWithBlocking(aTo));
}
if (allHaveCurrentData) {
// We can make progress if we're not blocked

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

@ -724,12 +724,6 @@ StreamTime DecodedStream::SentDuration() {
return std::max(mData->mStreamAudioWritten, mData->mStreamVideoWritten);
}
void DecodedStream::AdvanceTracks() {
AssertOwnerThread();
mData->mStream->AdvanceKnownTracksTime(mStreamTimeOffset + SentDuration());
}
void DecodedStream::SendData() {
AssertOwnerThread();
MOZ_ASSERT(mStartTime.isSome(), "Must be called after StartPlayback()");
@ -741,7 +735,6 @@ void DecodedStream::SendData() {
SendAudio(mParams.mVolume, mSameOrigin, mPrincipalHandle);
SendVideo(mSameOrigin, mPrincipalHandle);
AdvanceTracks();
}
TimeUnit DecodedStream::GetEndTime(TrackType aType) const {

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

@ -81,7 +81,6 @@ class DecodedStream : public media::MediaSink {
const PrincipalHandle& aPrincipalHandle);
void SendVideo(bool aIsSameOrigin, const PrincipalHandle& aPrincipalHandle);
StreamTime SentDuration();
void AdvanceTracks();
void SendData();
void NotifyOutput(int64_t aTime);
void NotifyTrackEnd(StreamTime aEndTime);

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

@ -562,9 +562,6 @@ void AudioNodeStream::ProduceOutputBeforeInput(GraphTime aFrom) {
void AudioNodeStream::AdvanceOutputSegment() {
StreamTracks::Track* track = EnsureTrack(AUDIO_TRACK);
// No more tracks will be coming
mTracks.AdvanceKnownTracksTime(STREAM_TIME_MAX);
AudioSegment* segment = track->Get<AudioSegment>();
AudioChunk copyChunk = *mLastChunks[0].AsMutableChunk();

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

@ -1673,7 +1673,6 @@ public:
mTrack.get(),
mSource.get()));
mSource->AdvanceKnownTracksTime(STREAM_TIME_MAX);
mSource->AddTrackListener(this, mTrackId);
}