Bug 1208371 - Add convenience method for checking if TrackID is explicit. r=roc

MozReview-Commit-ID: 330Fk17FJD4

--HG--
extra : rebase_source : 27395cdf427e6096f90097c1502b7930162d2c3e
This commit is contained in:
Andreas Pehrson 2016-01-05 10:16:22 +08:00
Родитель 1bffbe178b
Коммит f52f9b9310
4 изменённых файлов: 10 добавлений и 11 удалений

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

@ -240,10 +240,7 @@ public:
RefPtr<TrackPort> endedPort = mStream->FindPlaybackTrackPort(*track);
NS_ASSERTION(endedPort, "Playback track should have a TrackPort");
if (endedPort &&
endedPort->GetSourceTrackId() != TRACK_ANY &&
endedPort->GetSourceTrackId() != TRACK_INVALID &&
endedPort->GetSourceTrackId() != TRACK_NONE) {
if (endedPort && IsTrackIDExplicit(endedPort->GetSourceTrackId())) {
// If a track connected to a locked-track input port ends, we destroy the
// port to allow our playback stream to finish.
// XXX (bug 1208316) This should not be necessary when MediaStreams don't
@ -871,9 +868,7 @@ DOMMediaStream::FindPlaybackDOMTrack(MediaStream* aInputStream, TrackID aInputTr
info->GetInputPort()->GetSource() == aInputStream &&
info->GetSourceTrackId() == aInputTrackID) {
// This track is owned externally but in our playback stream.
MOZ_ASSERT(aInputTrackID != TRACK_NONE);
MOZ_ASSERT(aInputTrackID != TRACK_INVALID);
MOZ_ASSERT(aInputTrackID != TRACK_ANY);
MOZ_ASSERT(IsTrackIDExplicit(aInputTrackID));
return info->GetTrack();
}
}

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

@ -2781,7 +2781,7 @@ MediaInputPort::BlockTrackId(TrackID aTrackId)
TrackID mTrackId;
};
MOZ_ASSERT(aTrackId != TRACK_NONE && aTrackId != TRACK_INVALID && aTrackId != TRACK_ANY,
MOZ_ASSERT(IsTrackIDExplicit(aTrackId),
"Only explicit TrackID is allowed");
GraphImpl()->AppendMessage(MakeUnique<Message>(this, aTrackId));
}
@ -2812,8 +2812,8 @@ ProcessedMediaStream::AllocateInputPort(MediaStream* aStream, TrackID aTrackID,
};
MOZ_ASSERT(aStream->GraphImpl() == GraphImpl());
MOZ_ASSERT(aTrackID != TRACK_NONE && aTrackID != TRACK_INVALID,
"Only TRACK_ANY and explicit ID are allowed");
MOZ_ASSERT(aTrackID == TRACK_ANY || IsTrackIDExplicit(aTrackID),
"Only TRACK_ANY and explicit ID are allowed for source track");
RefPtr<MediaInputPort> port = new MediaInputPort(aStream, aTrackID, this,
aInputNumber, aOutputNumber);
port->SetGraphImpl(GraphImpl());

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

@ -21,6 +21,10 @@ const TrackID TRACK_NONE = 0;
const TrackID TRACK_INVALID = -1;
const TrackID TRACK_ANY = -2;
inline bool IsTrackIDExplicit(const TrackID& aId) {
return aId > TRACK_NONE;
}
inline TrackTicks RateConvertTicksRoundDown(TrackRate aOutRate,
TrackRate aInRate,
TrackTicks aTicks)

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

@ -490,7 +490,7 @@ MediaPipelineFactory::CreateMediaPipelineReceiving(
RefPtr<MediaPipelineReceive> pipeline;
TrackID numericTrackId = stream->GetNumericTrackId(aTrack.GetTrackId());
MOZ_ASSERT(numericTrackId != TRACK_INVALID);
MOZ_ASSERT(IsTrackIDExplicit(numericTrackId));
bool queue_track = stream->ShouldQueueTracks();