Bug 217316

Summary: Make sure to fire the correct set of events in case MediaRecorder stream has track changes
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebRTCAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, clopez, eric.carlson, esprehn+autocc, ews-watchlist, glenn, jer.noble, kondapallykalyan, philipj, sergio, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://github.com/web-platform-tests/wpt/pull/26006
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing none

Description youenn fablet 2020-10-05 08:33:14 PDT
WebKit MediaRecorderPrivate::startRecording callback should not set audio/video tracks if recorder is stopped
Comment 1 youenn fablet 2020-10-05 08:35:03 PDT
Or maybe add a clean method for MediaRecorderPrivate and call it in MediaRecorder::fetchData fetchDataCallback
Comment 2 youenn fablet 2020-10-06 02:12:57 PDT
Make sure to fire the correct set of events in case MediaRecorder stream has track changes
Comment 3 youenn fablet 2020-10-06 02:39:52 PDT
Created attachment 410620 [details]
Patch
Comment 4 EWS Watchlist 2020-10-06 02:40:35 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 5 youenn fablet 2020-10-06 02:44:12 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/26006
Comment 6 youenn fablet 2020-10-06 06:50:34 PDT
Created attachment 410631 [details]
Patch
Comment 7 Eric Carlson 2020-10-06 08:38:23 PDT
Comment on attachment 410631 [details]
Patch

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

> Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp:71
>      if (result.hasException())
>          return result.releaseException();
>  
> +    result.releaseReturnValue()->stop();
> +

As we discussed, I think it would be helpful to have a comment explaining why the private recorder is allocated and abandoned immediately.

> Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp:283
> +        dispatchError(Exception { InvalidModificationError, "Track cannot be added to or removed from the MediaStream while recording is happening"_s });

s/while recording is happening/while recording/

> LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-error.html:41
> +            assert_equals(mediaRecorderErrorEvent.error.name, 'InvalidModificationError', 'the type of error should be UnknownError when track has been added or removed');

s/should be UnknownError when/should be InvalidModificationError when/

> LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-error.html:60
> +            assert_equals(mediaRecorderErrorEvent.error.name, 'InvalidModificationError', 'the type of error should be UnknownError when track has been added or removed');

Ditto.
Comment 8 youenn fablet 2020-10-06 08:44:57 PDT
(In reply to Eric Carlson from comment #7)
> Comment on attachment 410631 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=410631&action=review
> 
> > Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp:71
> >      if (result.hasException())
> >          return result.releaseException();
> >  
> > +    result.releaseReturnValue()->stop();
> > +
> 
> As we discussed, I think it would be helpful to have a comment explaining
> why the private recorder is allocated and abandoned immediately.

I filed https://bugs.webkit.org/show_bug.cgi?id=217387 to keep track of this refactoring.
Comment 9 youenn fablet 2020-10-06 08:52:14 PDT
Created attachment 410643 [details]
Patch for landing
Comment 10 EWS 2020-10-07 02:22:53 PDT
Committed r268119: <https://trac.webkit.org/changeset/268119>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 410643 [details].
Comment 11 Radar WebKit Bug Importer 2020-10-07 02:23:17 PDT
<rdar://problem/70038607>