WebKit Bugzilla
Attachment 350083 Details for
Bug 189262
: Implement MediaStreamTrack Content Hints
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189262-20180918175246.patch (text/plain), 10.53 KB, created by
Wendy
on 2018-09-18 17:52:47 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wendy
Created:
2018-09-18 17:52:47 PDT
Size:
10.53 KB
patch
obsolete
>Subversion Revision: 235907 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 363bd7bab31921d9f60066a85bd2f96a936fa581..6652447938a497f5a19e2d9a5df80a4cd49180e5 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,35 @@ >+2018-09-18 YUHAN WU <yuhan_wu@apple.com> >+ >+ Implement MediaStreamTrack Content Hints >+ https://bugs.webkit.org/show_bug.cgi?id=189262 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests (OOPS!). >+ >+ * Modules/mediastream/MediaStreamTrack.cpp: >+ (WebCore::MediaStreamTrack::setContentHint const): >+ >+2018-09-17 YUHAN WU <yuhan_wu@apple.com> >+ >+ Implement MediaStreamTrack Content Hints >+ https://bugs.webkit.org/show_bug.cgi?id=189262 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests (OOPS!). >+ >+ * Modules/mediastream/MediaStreamTrack.cpp: >+ (WebCore::MediaStreamTrack::contentHint const): >+ (WebCore::MediaStreamTrack::setContentHint const): >+ * Modules/mediastream/MediaStreamTrack.h: >+ * Modules/mediastream/MediaStreamTrack.idl: >+ * platform/mediastream/MediaStreamTrackPrivate.cpp: >+ (WebCore::MediaStreamTrackPrivate::setContentHint): >+ * platform/mediastream/MediaStreamTrackPrivate.h: >+ (WebCore::MediaStreamTrackPrivate::contentHint const): >+ >+ > 2018-09-11 Michael Catanzaro <mcatanzaro@igalia.com> > > Unreviewed, fix some -Wreturn-type warnings >diff --git a/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp b/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp >index 2c1a5dbb2876d033ec504a6507c924dca4160d4b..f9b67097069611a8aefd34da9893c8d87e62b0a2 100644 >--- a/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp >+++ b/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp >@@ -92,6 +92,16 @@ const String& MediaStreamTrack::label() const > return m_private->label(); > } > >+const String& MediaStreamTrack::contentHint() const >+{ >+ return m_private->contentHint(); >+} >+ >+bool MediaStreamTrack::setContentHint(const String& hintValue) const >+{ >+ return m_private->setContentHint(hintValue); >+} >+ > bool MediaStreamTrack::enabled() const > { > return m_private->enabled(); >diff --git a/Source/WebCore/Modules/mediastream/MediaStreamTrack.h b/Source/WebCore/Modules/mediastream/MediaStreamTrack.h >index 47ab0cd1e372230cd5a92eba67617d422fbefee7..b628a37d341a223c990512045370417751e24d16 100644 >--- a/Source/WebCore/Modules/mediastream/MediaStreamTrack.h >+++ b/Source/WebCore/Modules/mediastream/MediaStreamTrack.h >@@ -69,6 +69,9 @@ public: > WEBCORE_EXPORT const String& id() const; > const String& label() const; > >+ const String& contentHint() const; >+ WEBCORE_EXPORT bool setContentHint(const String&) const; >+ > bool enabled() const; > void setEnabled(bool); > >diff --git a/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl b/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl >index 6559436fa6f2e43a1feb1ea3f663ab7d3619c25d..05d0ec995186fc3ff26f4554ac9c809772152641 100644 >--- a/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl >+++ b/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl >@@ -37,11 +37,13 @@ enum MediaStreamTrackState { "live", "ended" }; > readonly attribute DOMString id; > readonly attribute DOMString label; > attribute boolean enabled; >+ readonly attribute DOMString contentHint; > readonly attribute boolean muted; > attribute EventHandler onmute; > attribute EventHandler onunmute; > readonly attribute MediaStreamTrackState readyState; > attribute EventHandler onended; >+ boolean setContentHint(DOMString hintValue); > > MediaStreamTrack clone(); > [ImplementedAs=stopTrack] void stop(); >diff --git a/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp b/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp >index c60571fbc3fdaab75b47aab1f72d05c3a698efa6..9b005811c710caedc6f260fd76790d73c2d493a8 100644 >--- a/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp >+++ b/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp >@@ -96,6 +96,22 @@ const String& MediaStreamTrackPrivate::label() const > return m_source->name(); > } > >+bool MediaStreamTrackPrivate::setContentHint(const String& hintValue) >+{ >+ if (type() == RealtimeMediaSource::Type::Audio) { >+ if (hintValue == "" || hintValue == "speech" || hintValue == "music") { >+ m_contentHint = hintValue; >+ return true; >+ } >+ return false; >+ } >+ if (hintValue == "" || hintValue == "motion" || hintValue == "detail" || hintValue == "text") { >+ m_contentHint = hintValue; >+ return true; >+ } >+ return false; >+} >+ > bool MediaStreamTrackPrivate::muted() const > { > return m_source->muted(); >diff --git a/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h b/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h >index d4ff4d40faaf747809453e75aa38a7082f005f69..54469a4d03607a2782fe76514293128bf076d1b8 100644 >--- a/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h >+++ b/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h >@@ -66,6 +66,9 @@ public: > > bool ended() const { return m_isEnded; } > >+ const String& contentHint() const { return m_contentHint; } >+ bool setContentHint(const String&); >+ > void startProducingData() { m_source->start(); } > void stopProducingData() { m_source->stop(); } > bool isProducingData() { return m_source->isProducingData(); } >@@ -129,6 +132,7 @@ private: > bool m_isEnabled { true }; > bool m_isEnded { false }; > bool m_haveProducedData { false }; >+ String m_contentHint; > RefPtr<WebAudioSourceProvider> m_audioSourceProvider; > }; > >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 1c1cd2573833e5e1d4948e29e7faedf0bc853d3f..855eb045d83a852af80069c96cd1196d4cd7ac2a 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,23 @@ >+2018-09-18 YUHAN WU <yuhan_wu@apple.com> >+ >+ Implement MediaStreamTrack Content Hints >+ https://bugs.webkit.org/show_bug.cgi?id=189262 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/mediacapture-streams/MediaStreamTrack-contentHint.https-expected.txt: Added. >+ * web-platform-tests/mediacapture-streams/MediaStreamTrack-contentHint.https.html: Added. >+ >+2018-09-17 YUHAN WU <yuhan_wu@apple.com> >+ >+ MediaStream-MediaElement-srcObject.https.html expects video duration for a MediaStream to be Infinity and is currently NaN >+ https://bugs.webkit.org/show_bug.cgi?id=189516 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/mediacapture-streams/MediaStream-MediaElement-srcObject.https.html: >+ * web-platform-tests/resources/testharness.js: >+ > 2018-09-17 YUHAN WU <yuhan_wu@apple.com> > > MediaStream-MediaElement-srcObject.https.html expects video duration for a MediaStream to be Infinity and is currently NaN >@@ -28,8 +48,8 @@ > > 2018-09-17 YUHAN WU <yuhan_wu@apple.com> > >- Need a short description (OOPS!). >- Need the bug URL (OOPS!). >+ Implement MediaStreamTrack Content Hints >+ https://bugs.webkit.org/show_bug.cgi?id=189262 > > Reviewed by NOBODY (OOPS!). > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-contentHint.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-contentHint.https-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6e9c2374a04d6f621099054fb85fe4c50f174a71 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-contentHint.https-expected.txt >@@ -0,0 +1,9 @@ >+When prompted, accept to share your audio and video stream. >+ >+Description >+ >+This test checks if only the specific value can be put on contentHint. >+ >+ >+PASS Test if only the specific value can be put on contentHint >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-contentHint.https.html b/LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-contentHint.https.html >new file mode 100644 >index 0000000000000000000000000000000000000000..87c145c3cd4cf27dc634f9c4a546785795d43120 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-contentHint.https.html >@@ -0,0 +1,45 @@ >+<!doctype html> >+<html> >+<head> >+<title>Test if the contentHint can be set correctly</title> >+<link rel="author" title="Yuhan Wu" href="mailto:dom@w3.org"/> >+<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrack-id"> >+</head> >+<body> >+<p class="instructions">When prompted, accept to share your audio and video stream.</p> >+<h1 class="instructions">Description</h1> >+<p class="instructions">This test checks if only the specific value can be put on contentHint.</p> >+ >+<div id='log'></div> >+<script src=/resources/testharness.js></script> >+<script src=/resources/testharnessreport.js></script> >+<script> >+var t = async_test("Test if only the specific value can be put on contentHint ", {timeout: 10000}); >+t.step(function () { >+ navigator.mediaDevices.getUserMedia({video: true, audio: true}) >+ .then(t.step_func(gotStream), t.step_func(function(error) {t.assert_unreached("Access to audio and video stream is granted");})); >+ function gotStream(stream) { >+ var hintValueAudio = ['speech', 'music', '']; >+ var hintValueVideo = ['detail', 'text', 'motion', '']; >+ const videoTrack = stream.getVideoTracks()[0]; >+ const audioTrack = stream.getAudioTracks()[0]; >+ assert_equals(videoTrack.contentHint, '', 'video track have a non-empty initial contentHint'); >+ assert_equals(audioTrack.contentHint, '', 'audio track have a non-empty initial contentHint'); >+ for(let value in hintValueAudio) { >+ audioTrack.setContentHint(hintValueAudio[value]); >+ assert_equals(audioTrack.contentHint, hintValueAudio[value], 'audio track failed to set a contentHint'); >+ } >+ for(let value in hintValueVideo) { >+ videoTrack.setContentHint(hintValueVideo[value]); >+ assert_equals(videoTrack.contentHint, hintValueVideo[value], 'video track failed to set a contentHint'); >+ } >+ audioTrack.setContentHint('invalid hint value'); >+ assert_equals(audioTrack.contentHint, '', 'audio track put a invalid value to contentHint'); >+ videoTrack.setContentHint('invalid hint value'); >+ assert_equals(videoTrack.contentHint, '', 'video track put a invalid value to contentHint'); >+ t.done(); >+ } >+}); >+</script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189262
:
350083
|
350291
|
350292
|
350407
|
350459
|
350460
|
350484
|
350490
|
350492
|
350708
|
350720
|
350727
|
350761
|
350785