Closed Bug 1208390 Opened 9 years ago Closed 9 years ago

Implement MediaStream.getTrackById()

Categories

(Core :: Audio/Video: MediaStreamGraph, defect, P2)

33 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: pehrsons, Assigned: pehrsons)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(3 files)

This seems trivial but wasn't covered by any other bug. We should implement this to make the API complete.
Rank: 25
Priority: -- → P2
Assignee: nobody → pehrsons
Status: NEW → ASSIGNED
Comment on attachment 8754784 [details] MozReview Request: Bug 1208390 - Implement MediaStream.getTrackById(). r?jib, r?smaug https://reviewboard.mozilla.org/r/54248/#review50934
Attachment #8754784 - Flags: review?(bugs) → review+
Comment on attachment 8754782 [details] MozReview Request: Bug 1208390 - Add test for MediaStream.getTrackById(). r?jib https://reviewboard.mozilla.org/r/54244/#review50964
Attachment #8754782 - Flags: review?(jib) → review+
Comment on attachment 8754783 [details] MozReview Request: Bug 1208390 - Use MediaStream.getTrackById() in some existing tests. r?jib https://reviewboard.mozilla.org/r/54246/#review50968 ::: dom/media/tests/mochitest/pc.js:1134 (Diff revision 1) > return this._pc.getRemoteStreams().some(stream => { > - return stream.getTracks().some(pcTrack => pcTrack.id == track.id); > + return !!stream.getTrackById(track.id); Nit: An opportunity to remove {} and return ? ::: dom/media/tests/mochitest/pc.js:1481 (Diff revision 1) > var inputElem = from.localMediaElements[0]; > > // As input we use the stream of |from|'s first available audio sender. > var inputSenderTracks = from._pc.getSenders().map(sn => sn.track); > var inputAudioStream = from._pc.getLocalStreams() > - .find(s => s.getAudioTracks().some(t => inputSenderTracks.some(t2 => t == t2))); > + .find(s => inputSenderTracks.some(t => t.kind == "audio" && !!s.getTrackById(t.id))); !! is redundant here.
Attachment #8754783 - Flags: review?(jib) → review+
Comment on attachment 8754784 [details] MozReview Request: Bug 1208390 - Implement MediaStream.getTrackById(). r?jib, r?smaug https://reviewboard.mozilla.org/r/54248/#review50984 ::: dom/media/DOMMediaStream.h:352 (Diff revision 1) > void GetAudioTracks(nsTArray<RefPtr<AudioStreamTrack> >& aTracks) const; > void GetVideoTracks(nsTArray<RefPtr<VideoStreamTrack> >& aTracks) const; > void GetTracks(nsTArray<RefPtr<MediaStreamTrack> >& aTracks) const; > + MediaStreamTrack* GetTrackById(const nsAString& aId); Maybe const like the others here?
Attachment #8754784 - Flags: review?(jib) → review+
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: