Diff
Modified: branches/safari-604.1.21-branch/LayoutTests/ChangeLog (216956 => 216957)
--- branches/safari-604.1.21-branch/LayoutTests/ChangeLog 2017-05-16 23:44:41 UTC (rev 216956)
+++ branches/safari-604.1.21-branch/LayoutTests/ChangeLog 2017-05-16 23:44:45 UTC (rev 216957)
@@ -1,3 +1,18 @@
+2017-05-16 Jason Marcell <jmarc...@apple.com>
+
+ Cherry-pick r216892. rdar://problem/31513869
+
+ 2017-05-15 Youenn Fablet <you...@apple.com>
+
+ WebRTC outgoing muted video sources should send black frames
+ https://bugs.webkit.org/show_bug.cgi?id=170627
+ <rdar://problem/31513869>
+
+ Reviewed by Eric Carlson.
+
+ * webrtc/video-mute-expected.txt:
+ * webrtc/video-mute.html:
+
2017-05-15 Matthew Hanson <matthew_han...@apple.com>
Cherry-pick r216836. rdar://problem/31899730
Modified: branches/safari-604.1.21-branch/LayoutTests/webrtc/video-mute-expected.txt (216956 => 216957)
--- branches/safari-604.1.21-branch/LayoutTests/webrtc/video-mute-expected.txt 2017-05-16 23:44:41 UTC (rev 216956)
+++ branches/safari-604.1.21-branch/LayoutTests/webrtc/video-mute-expected.txt 2017-05-16 23:44:45 UTC (rev 216957)
@@ -5,5 +5,6 @@
PASS Setting video exchange
PASS Track is enabled, video should not be black
PASS Track is disabled, video should be black
+PASS If disabled, black frames should still be coming
PASS Track is enabled, video should not be black
Modified: branches/safari-604.1.21-branch/LayoutTests/webrtc/video-mute.html (216956 => 216957)
--- branches/safari-604.1.21-branch/LayoutTests/webrtc/video-mute.html 2017-05-16 23:44:41 UTC (rev 216956)
+++ branches/safari-604.1.21-branch/LayoutTests/webrtc/video-mute.html 2017-05-16 23:44:45 UTC (rev 216957)
@@ -46,11 +46,12 @@
{
return new Promise((resolve, reject) => {
pollVideoBlackCheck(expected, id, resolve);
- setTimeout(reject, 5000);
+ setTimeout(() => reject("checkVideoBlack timed out for " + id + " expected " + expected), 5000);
});
}
var track;
+var remoteTrack;
promise_test((test) => {
if (window.testRunner)
testRunner.setUserMediaPermission(true);
@@ -62,7 +63,10 @@
createConnections((firstConnection) => {
firstConnection.addTrack(track, localStream);
}, (secondConnection) => {
- secondConnection._ontrack_ = (trackEvent) => { resolve(trackEvent.streams[0]); };
+ secondConnection._ontrack_ = (trackEvent) => {
+ remoteTrack = trackEvent.track;
+ resolve(trackEvent.streams[0]);
+ };
});
setTimeout(() => reject("Test timed out"), 5000);
});
@@ -82,9 +86,25 @@
}, "Track is disabled, video should be black");
promise_test((test) => {
+ if (!window.internals)
+ return Promise.reject("This test requires internals API");
+ internals.observeMediaStreamTrack(remoteTrack);
+ let counter = internals.trackVideoSampleCount;
+ return new Promise((resolve, reject) => {
+ setInterval(() => {
+ // Should get 1 frame per second.
+ if (internals.trackVideoSampleCount - counter >= 2)
+ resolve();
+ }, 300);
+ setTimeout(() => reject("did not get frames"), 5000);
+ });
+}, "If disabled, black frames should still be coming");
+
+promise_test((test) => {
track.enabled = true;
return checkVideoBlack(true, "canvas2");
}, "Track is enabled, video should not be black");
+
</script>
</body>
</html>
Modified: branches/safari-604.1.21-branch/Source/WebCore/ChangeLog (216956 => 216957)
--- branches/safari-604.1.21-branch/Source/WebCore/ChangeLog 2017-05-16 23:44:41 UTC (rev 216956)
+++ branches/safari-604.1.21-branch/Source/WebCore/ChangeLog 2017-05-16 23:44:45 UTC (rev 216957)
@@ -1,5 +1,31 @@
2017-05-16 Jason Marcell <jmarc...@apple.com>
+ Cherry-pick r216892. rdar://problem/31513869
+
+ 2017-05-15 Youenn Fablet <you...@apple.com>
+
+ WebRTC outgoing muted video sources should send black frames
+ https://bugs.webkit.org/show_bug.cgi?id=170627
+ <rdar://problem/31513869>
+
+ Reviewed by Eric Carlson.
+
+ Covered by updated test.
+
+ Instead of sending one black frame and then another one asynchronously,
+ we use the timer to send a black frame every second when outgoing source is muted.
+
+ * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
+ (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
+ (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
+ (WebCore::RealtimeOutgoingVideoSource::sendBlackFrames):
+ (WebCore::RealtimeOutgoingVideoSource::sendBlackFrame): Deleted.
+ * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
+ * testing/Internals.cpp:
+ (WebCore::Internals::videoSampleAvailable):
+
+2017-05-16 Jason Marcell <jmarc...@apple.com>
+
Cherry-pick r216257. rdar://problem/32014052
2017-05-05 Wenson Hsieh <wenson_hs...@apple.com>
Modified: branches/safari-604.1.21-branch/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp (216956 => 216957)
--- branches/safari-604.1.21-branch/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp 2017-05-16 23:44:41 UTC (rev 216956)
+++ branches/safari-604.1.21-branch/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp 2017-05-16 23:44:45 UTC (rev 216957)
@@ -83,8 +83,12 @@
m_muted = m_videoSource->muted();
- if (m_muted && m_sinks.size() && m_enabled)
- sendBlackFrame();
+ if (m_muted && m_sinks.size() && m_enabled) {
+ sendBlackFrames();
+ return;
+ }
+ if (m_blackFrameTimer.isActive())
+ m_blackFrameTimer.stop();
}
void RealtimeOutgoingVideoSource::sourceEnabledChanged()
@@ -93,8 +97,12 @@
m_enabled = m_videoSource->enabled();
- if (!m_enabled && m_sinks.size() && !m_muted)
- sendBlackFrame();
+ if (!m_enabled && m_sinks.size() && !m_muted) {
+ sendBlackFrames();
+ return;
+ }
+ if (m_blackFrameTimer.isActive())
+ m_blackFrameTimer.stop();
}
void RealtimeOutgoingVideoSource::setSizeFromSource()
@@ -121,7 +129,7 @@
m_sinks.removeFirst(sink);
}
-void RealtimeOutgoingVideoSource::sendBlackFrame()
+void RealtimeOutgoingVideoSource::sendBlackFrames()
{
if (!m_blackFrame) {
auto frame = m_bufferPool.CreateBuffer(m_width, m_height);
@@ -129,8 +137,7 @@
m_blackFrame = WTFMove(frame);
}
sendOneBlackFrame();
- // FIXME: We should not need to send two black frames but VTB requires that so we are sure a black frame is sent over the wire.
- m_blackFrameTimer.startOneShot(0_s);
+ m_blackFrameTimer.startRepeating(1_s);
}
void RealtimeOutgoingVideoSource::sendOneBlackFrame()
Modified: branches/safari-604.1.21-branch/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h (216956 => 216957)
--- branches/safari-604.1.21-branch/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h 2017-05-16 23:44:41 UTC (rev 216956)
+++ branches/safari-604.1.21-branch/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h 2017-05-16 23:44:45 UTC (rev 216957)
@@ -58,7 +58,7 @@
RealtimeOutgoingVideoSource(Ref<RealtimeMediaSource>&&);
void sendFrame(rtc::scoped_refptr<webrtc::VideoFrameBuffer>&&);
- void sendBlackFrame();
+ void sendBlackFrames();
void sendOneBlackFrame();
void setSizeFromSource();
Modified: branches/safari-604.1.21-branch/Source/WebCore/testing/Internals.cpp (216956 => 216957)
--- branches/safari-604.1.21-branch/Source/WebCore/testing/Internals.cpp 2017-05-16 23:44:41 UTC (rev 216956)
+++ branches/safari-604.1.21-branch/Source/WebCore/testing/Internals.cpp 2017-05-16 23:44:45 UTC (rev 216957)
@@ -4001,14 +4001,15 @@
if (!m_nextTrackFramePromise)
return;
- auto videoSettings = m_track->getSettings();
- if (!videoSettings.width || !videoSettings.height)
+ auto& videoSettings = m_track->source().settings();
+ if (!videoSettings.width() || !videoSettings.height())
return;
-
+
auto rgba = sample.getRGBAImageData();
if (!rgba)
return;
- auto imageData = ImageData::create(rgba.releaseNonNull(), *videoSettings.width, *videoSettings.height);
+
+ auto imageData = ImageData::create(rgba.releaseNonNull(), videoSettings.width(), videoSettings.height());
if (!imageData.hasException())
m_nextTrackFramePromise->resolve(imageData.releaseReturnValue().releaseNonNull());
else