Because the media stream has been cut off by the system when the app enters the background, muting the page while the host application is in the background does not properly update the state, and therefore when the app re-enters the foreground the media stream becomes unmuted.
<rdar://problem/31821492>
Created attachment 308966 [details] Proposed patch.
Created attachment 308972 [details] Rebased patch.
Comment on attachment 308966 [details] Proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=308966&action=review > Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:129 > - m_ended = true; > + if (mode == StopMode::Silently) > + m_ended = true; > + > + > m_private->endTrack(); > + m_ended = true; Nit: I think this may deserve a comment; the side effects here are subtle, and it would be a shame if a future developer (e.g., me) accidentally broke this.
Created attachment 308977 [details] Patch for landing.
Attachment 308977 [details] did not pass style-queue: ERROR: Source/WebKit2/UIProcess/UserMediaProcessManager.cpp:250: One line control clauses should not use braces. [whitespace/braces] [4] Total errors found: 1 in 35 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 308977 [details] Patch for landing. Rejecting attachment 308977 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'build', '--no-clean', '--no-update', '--build-style=release', '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Last 500 characters of output: WebKit/Tools/WebKitTestRunner/WorkQueueManager.cpp -o /Volumes/Data/EWS/WebKit/WebKitBuild/WebKitTestRunner.build/Release/WebKitTestRunner\ (Library).build/Objects-normal/x86_64/WorkQueueManager.o ** BUILD FAILED ** The following build commands failed: CompileC /Volumes/Data/EWS/WebKit/WebKitBuild/WebKitTestRunner.build/Release/WebKitTestRunner\ (Library).build/Objects-normal/x86_64/TestController.o TestController.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (1 failure) Full output: http://webkit-queues.webkit.org/results/3667447
Created attachment 308983 [details] Updated patch.
Created attachment 308988 [details] Another patch for landing.
Comment on attachment 308988 [details] Another patch for landing. Committed r216160: https://trac.webkit.org/r216160
The iOS builds were still broken after this change: https://build.webkit.org/builders/Apple%20iOS%2010%20Simulator%20Release%20%28Build%29/builds/1361 Rolled out in: http://trac.webkit.org/changeset/216162
It also looks like there was an API test failures on macOS before this was rolled out: https://build.webkit.org/builders/Apple%20Sierra%20Release%20WK1%20(Tests)/builds/1252 FAIL MediaCaptureDisabledTest.EnableAndDisable /Volumes/Data/slave/sierra-release/build/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/UserMediaDisabled.mm:119 Value of: message Actual: "allowed" Expected: [(NSString *)[lastScriptMessage body] UTF8String] Which is: "gUM allowed" /Volumes/Data/slave/sierra-release/build/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/UserMediaDisabled.mm:119 Value of: message Actual: "denied" Expected: [(NSString *)[lastScriptMessage body] UTF8String] Which is: "gUM denied" /Volumes/Data/slave/sierra-release/build/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/UserMediaDisabled.mm:119 Value of: message Actual: "allowed" Expected: [(NSString *)[lastScriptMessage body] UTF8String] Which is: "gUM allowed"
Created attachment 309008 [details] Update patch.
Comment on attachment 309008 [details] Update patch. Clearing flags on attachment: 309008 Committed r216172: <http://trac.webkit.org/changeset/216172>
Rolled out in r216183.
Created attachment 309060 [details] One more time.
Comment on attachment 309060 [details] One more time. Clearing flags on attachment: 309060 Committed r216197: <http://trac.webkit.org/changeset/216197>
Comment on attachment 309060 [details] One more time. Attachment 309060 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/3673639 New failing tests: webrtc/audio-replace-track.html
Created attachment 309080 [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.11.6
(In reply to Build Bot from comment #18) > Comment on attachment 309060 [details] > One more time. > > Attachment 309060 [details] did not pass ios-sim-ews (ios-simulator-wk2): > Output: http://webkit-queues.webkit.org/results/3673639 > > New failing tests: > webrtc/audio-replace-track.html This test is failing on iOS simulator after r216197 landed (alongside a timeout seen with webrtc/video-replace-track.html) https://build.webkit.org/builders/Apple%20iOS%2010%20Simulator%20Release%20WK2%20(Tests)/builds/1185
(In reply to Ryan Haddad from comment #20) > (In reply to Build Bot from comment #18) > > Comment on attachment 309060 [details] > > One more time. > > > > Attachment 309060 [details] did not pass ios-sim-ews (ios-simulator-wk2): > > Output: http://webkit-queues.webkit.org/results/3673639 > > > > New failing tests: > > webrtc/audio-replace-track.html > > This test is failing on iOS simulator after r216197 landed (alongside a > timeout seen with webrtc/video-replace-track.html) > > https://build.webkit.org/builders/ > Apple%20iOS%2010%20Simulator%20Release%20WK2%20(Tests)/builds/1185 Filed https://bugs.webkit.org/show_bug.cgi?id=171728.
*** Bug 169304 has been marked as a duplicate of this bug. ***