Bug 198840

Summary: Changing settings of a MediaStreamTrack clone should not alter the settings of the original track
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebRTCAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric.carlson, ews-watchlist, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=187677
Attachments:
Description Flags
Patch
none
Patch
none
Archive of layout-test-results from ews125 for ios-simulator-wk2
none
Patch
none
Patch for landing none

Description youenn fablet 2019-06-13 12:53:45 PDT
Especially video resolution.
Comment 1 youenn fablet 2019-06-18 23:04:21 PDT
Created attachment 372437 [details]
Patch
Comment 2 EWS Watchlist 2019-06-18 23:06:05 PDT
Attachment 372437 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/mediastream/RealtimeMediaSource.h:99:  Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line.  [build/webcore_export] [4]
Total errors found: 1 in 20 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 youenn fablet 2019-06-19 07:26:36 PDT
Created attachment 372460 [details]
Patch
Comment 4 EWS Watchlist 2019-06-19 07:29:09 PDT
Attachment 372460 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/mediastream/RealtimeMediaSource.h:99:  Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line.  [build/webcore_export] [4]
Total errors found: 1 in 21 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 EWS Watchlist 2019-06-19 09:28:29 PDT
Comment on attachment 372460 [details]
Patch

Attachment 372460 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/12520994

New failing tests:
platform/ios/mediastream/getUserMedia-single-capture.html
platform/ios/mediastream/audio-muted-in-background-tab.html
platform/ios/mediastream/video-muted-in-background-tab.html
Comment 6 EWS Watchlist 2019-06-19 09:28:31 PDT
Created attachment 372466 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.14.5
Comment 7 youenn fablet 2019-06-19 11:13:53 PDT
Created attachment 372479 [details]
Patch
Comment 8 EWS Watchlist 2019-06-19 11:15:13 PDT
Attachment 372479 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/mediastream/RealtimeMediaSource.h:99:  Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line.  [build/webcore_export] [4]
Total errors found: 1 in 21 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 youenn fablet 2019-06-19 12:57:20 PDT
Comment on attachment 372479 [details]
Patch

Patch ready to review.
The idea behind this patch would be to have RealtimeVideoSource be fully responsible for frame rate/size adaptation.
This would remove the need for RealtimeVideoCaptureSource to be a RealtimeMediaSource , which might simplify things. It could instead become a RealtimeCamera or something like that.
Comment 10 Eric Carlson 2019-06-19 16:25:58 PDT
Comment on attachment 372479 [details]
Patch

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

> Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp:185
> +        for (auto& size : standardVideoSizes()) {
> +            if (size.width() < minimumWidth || size.height() < minimumHeight)
> +                minimumAspectRatio = std::min(minimumAspectRatio, static_cast<double>(size.width()) / size.height());
> +        }

This isn't new, but I don't think this look is necessary because minimumWidth and  minimumHeight are both 1.

> Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp:205
> +    const double epsilon = 0.001;
> +    return frameRate + epsilon >= range.minimum && frameRate - epsilon <= range.maximum;

Also not new, but I wonder if we could use WTF::areEssentiallyEqual here?

> Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp:444
> +    if (!match)
> +        return;

Logging an error here might be helpful.

> Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp:73
> +    if (!width)
> +        width = sourceSize.width() * height.value() / sourceSize.height();
> +    m_currentSettings.setWidth(*width);

Maybe we should ASSERT(sourceSize.width() && sourceSize.height()) since we will get a divide-by-zero crash if either is zero.
Comment 11 youenn fablet 2019-06-20 09:35:33 PDT
Thanks for the review.

(In reply to Eric Carlson from comment #10)
> Comment on attachment 372479 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=372479&action=review
> 
> > Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp:185
> > +        for (auto& size : standardVideoSizes()) {
> > +            if (size.width() < minimumWidth || size.height() < minimumHeight)
> > +                minimumAspectRatio = std::min(minimumAspectRatio, static_cast<double>(size.width()) / size.height());
> > +        }
> 
> This isn't new, but I don't think this look is necessary because
> minimumWidth and  minimumHeight are both 1.

OK, I'll remove this one.

> 
> > Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp:205
> > +    const double epsilon = 0.001;
> > +    return frameRate + epsilon >= range.minimum && frameRate - epsilon <= range.maximum;
> 
> Also not new, but I wonder if we could use WTF::areEssentiallyEqual here?

Probably, I'll do the change in a follow-up.

> > Source/WebCore/platform/mediastream/RealtimeVideoCaptureSource.cpp:444
> > +    if (!match)
> > +        return;
> 
> Logging an error here might be helpful.

OK

> > Source/WebCore/platform/mediastream/RealtimeVideoSource.cpp:73
> > +    if (!width)
> > +        width = sourceSize.width() * height.value() / sourceSize.height();
> > +    m_currentSettings.setWidth(*width);
> 
> Maybe we should ASSERT(sourceSize.width() && sourceSize.height()) since we
> will get a divide-by-zero crash if either is zero.

OK
Comment 12 youenn fablet 2019-06-20 09:37:08 PDT
Created attachment 372561 [details]
Patch for landing
Comment 13 EWS Watchlist 2019-06-20 09:38:51 PDT
Attachment 372561 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/mediastream/RealtimeMediaSource.h:99:  Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line.  [build/webcore_export] [4]
Total errors found: 1 in 21 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 14 WebKit Commit Bot 2019-06-20 11:55:40 PDT
Comment on attachment 372561 [details]
Patch for landing

Clearing flags on attachment: 372561

Committed r246644: <https://trac.webkit.org/changeset/246644>
Comment 15 WebKit Commit Bot 2019-06-20 11:55:41 PDT
All reviewed patches have been landed.  Closing bug.
Comment 16 Radar WebKit Bug Importer 2019-06-20 11:56:25 PDT
<rdar://problem/51953374>