Bug 175434

Summary: WebRTC MediaStream created without tracks does not update active state after tracks are added
Product: WebKit Reporter: brian
Component: WebRTCAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric.carlson, gp, jonlee, youennf
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
javascript test to illustrate the bug
none
Patch none

Description brian 2017-08-10 11:15:12 PDT
Created attachment 317827 [details]
javascript test to illustrate the bug

Summary:
When a new MediaStream is created manually, its "active" field is set to false (which is correct).  However, after adding an active track to the stream, its "active" field is not updated, and remains false.  It should update to reflect the state of its tracks.

Steps to Reproduce:
1) Create a MediaStream with a video track via getUserMedia ("ms1")
2) Create a new MediaStream manually (via something like "var ms2 = new MediaStream()"
3) Do: ms2.addTrack(ms1.getVideoTracks()[0]);

Expected Results:
ms2 should be active ("active: true")

Observed Results:
ms2 isn't active ("active: false")

Version:
Release 35 (Safari 11.0, WebKit 12604.1.29)

Notes:
Attached a simple example html file that reproduces the issue

Configuration:
This is running on a macbook, running Sierra 10.12.5 (16F73)
Comment 1 youenn fablet 2017-08-10 11:42:04 PDT
rdar://problem/33358476
Comment 2 youenn fablet 2017-08-10 11:42:58 PDT
Thanks for filing this bug.
So you only rely on the active attribute, not on any event that would be sent if the active attribute value is changing, right?
Comment 3 brian 2017-08-10 11:44:45 PDT
i don't think we rely on any event, what i was running into was tests on the 'active' member failing, so that would at least let me get past where i was stuck.
Comment 4 brian 2017-08-28 10:26:25 PDT
hey youenn, any idea when this will be fixed in tech preview?
Comment 5 youenn fablet 2017-08-28 13:52:32 PDT
Created attachment 319204 [details]
Patch
Comment 6 Eric Carlson 2017-08-28 14:50:17 PDT
Comment on attachment 319204 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=319204&action=review

> LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-clone-track-expected.txt:2
> +FAIL check clone track after captureStream() cloned_track.requestFrame is not a function. (In 'cloned_track.requestFrame()', 'cloned_track.requestFrame' is undefined)

This seems wrong.
Comment 7 youenn fablet 2017-08-28 15:08:49 PDT
(In reply to Eric Carlson from comment #6)
> Comment on attachment 319204 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=319204&action=review
> 
> > LayoutTests/fast/mediacapturefromelement/CanvasCaptureMediaStream-clone-track-expected.txt:2
> > +FAIL check clone track after captureStream() cloned_track.requestFrame is not a function. (In 'cloned_track.requestFrame()', 'cloned_track.requestFrame' is undefined)
> 
> This seems wrong.

I filed https://bugs.webkit.org/show_bug.cgi?id=176036
Comment 8 WebKit Commit Bot 2017-08-28 15:38:17 PDT
Comment on attachment 319204 [details]
Patch

Clearing flags on attachment: 319204

Committed r221277: <http://trac.webkit.org/changeset/221277>
Comment 9 WebKit Commit Bot 2017-08-28 15:38:18 PDT
All reviewed patches have been landed.  Closing bug.