Bug 1208371 - Fix DOMMediaStream::OwnsTrack. r=roc

MozReview-Commit-ID: 3uPqOYJZq2k

--HG--
extra : rebase_source : f4dba615271b884298efd0c646f7104c45c372d8
This commit is contained in:
Andreas Pehrson 2016-01-05 10:16:25 +08:00
Родитель 84740b0197
Коммит dcc36821e9
2 изменённых файлов: 19 добавлений и 1 удалений

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

@ -633,7 +633,7 @@ DOMMediaStream::HasTrack(const MediaStreamTrack& aTrack) const
bool
DOMMediaStream::OwnsTrack(const MediaStreamTrack& aTrack) const
{
return (aTrack.GetStream() == this) && HasTrack(aTrack);
return !!FindOwnedTrackPort(aTrack);
}
bool
@ -895,6 +895,18 @@ DOMMediaStream::FindOwnedDOMTrack(MediaStream* aInputStream,
return nullptr;
}
DOMMediaStream::TrackPort*
DOMMediaStream::FindOwnedTrackPort(const MediaStreamTrack& aTrack) const
{
for (const RefPtr<TrackPort>& info : mOwnedTracks) {
if (info->GetTrack() == &aTrack) {
return info;
}
}
return nullptr;
}
MediaStreamTrack*
DOMMediaStream::FindPlaybackDOMTrack(MediaStream* aInputStream, TrackID aInputTrackID) const
{

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

@ -385,6 +385,12 @@ public:
MediaStreamTrack* FindOwnedDOMTrack(MediaStream* aOwningStream,
TrackID aInputTrackID) const;
/**
* Returns the TrackPort connecting aTrack's input stream to mOwnedStream,
* or nullptr if aTrack is not owned by this DOMMediaStream.
*/
TrackPort* FindOwnedTrackPort(const MediaStreamTrack& aTrack) const;
/**
* Returns the corresponding MediaStreamTrack if it's in our mPlaybackStream.
* aInputTrackID should match the track's TrackID in its owned stream.