haikuwebkit/LayoutTests/webrtc/peer-connection-audio-unmut...

46 lines
1.7 KiB
HTML
Raw Permalink Normal View History

PeerConnection should respect tracks that are muted at the time they are added https://bugs.webkit.org/show_bug.cgi?id=172771 Patch by Youenn Fablet <youenn@apple.com> on 2017-05-31 Reviewed by Eric Carlson. Source/WebCore: Tests: webrtc/peer-connection-audio-unmute.html webrtc/video-unmute.html Making sure that muted/enabled state of sources are correctly handled at creation time of the outgoing webrtc sources. This should trigger silent audio and black frames. * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp: (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource): (WebCore::RealtimeOutgoingAudioSource::setSource): (WebCore::RealtimeOutgoingAudioSource::initializeConverter): * platform/mediastream/mac/RealtimeOutgoingAudioSource.h: * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource): (WebCore::RealtimeOutgoingVideoSource::setSource): (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged): (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged): (WebCore::RealtimeOutgoingVideoSource::initializeFromSource): (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): (WebCore::RealtimeOutgoingVideoSource::RemoveSink): (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded): (WebCore::RealtimeOutgoingVideoSource::setSizeFromSource): Deleted. (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames): Deleted. * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: LayoutTests: * webrtc/audio-replace-track.html: * webrtc/peer-connection-audio-unmute-expected.txt: Added. * webrtc/peer-connection-audio-unmute.html: Added. * webrtc/routines.js: * webrtc/video-unmute-expected.txt: Added. * webrtc/video-unmute.html: Added. Canonical link: https://commits.webkit.org/189671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-05-31 20:51:12 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>A muted audio track that is added should not cause audio to be sent</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<script src ="routines.js"></script>
<script>
promise_test((test) => {
if (window.testRunner)
testRunner.setUserMediaPermission(true);
var localTrack;
return navigator.mediaDevices.getUserMedia({audio: true}).then((localStream) => {
localTrack = localStream.getAudioTracks()[0];
localTrack.enabled = false;
var remoteStream;
return new Promise((resolve, reject) => {
createConnections((firstConnection) => {
firstConnection.addTrack(localTrack, localStream);
}, (secondConnection) => {
secondConnection.ontrack = (trackEvent) => {
remoteStream = trackEvent.streams[0];
resolve();
};
});
}).then(() => {
return doHumAnalysis(remoteStream, false).then((result) => {
assert_true(result, "Should not hear hum");
});
}).then(() => {
localTrack.enabled = true;
}).then(() => {
return doHumAnalysis(remoteStream, true).then((result) => {
assert_true(result, "Should hear hum");
});
});
});
}, "Muting a local audio track before adding it should be correctly handled");
</script>
</body>
</html>