Changeset 267713 in webkit
- Timestamp:
- Sep 28, 2020, 1:21:03 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/html/HTMLMediaElement.cpp (modified) (1 diff)
-
WebCore/platform/graphics/PlatformTextTrack.h (modified) (5 diffs)
-
WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (modified) (4 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp (modified) (1 diff)
-
WebKit/GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h (modified) (5 diffs)
-
WebKit/Scripts/webkit/messages.py (modified) (1 diff)
-
WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp (modified) (2 diffs)
-
WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r267711 r267713 1 2020-09-28 Eric Carlson <eric.carlson@apple.com> 2 3 [GPUP] Out-of-band TextTracks 4 https://bugs.webkit.org/show_bug.cgi?id=217062 5 <rdar://problem/68739969> 6 7 Reviewed by Jer Noble. 8 9 Add support for passing out-of-band TextTracks to a media engine running in the GPU process. 10 11 No new tests, this can only be tested with a specific hardware setup. 12 13 * html/HTMLMediaElement.cpp: 14 (WebCore::toPlatform): 15 * platform/graphics/PlatformTextTrack.h: Put instance variables into a struct so 16 state can be encoded and decoded. 17 (WebCore::PlatformTextTrackData::PlatformTextTrackData): 18 (WebCore::PlatformTextTrackData::decode): 19 (WebCore::PlatformTextTrackData::encode const): 20 (WebCore::PlatformTextTrackClient::privateTrack): 21 (WebCore::PlatformTextTrack::create): 22 (WebCore::PlatformTextTrack::createOutOfBand): 23 (WebCore::PlatformTextTrack::type const): 24 (WebCore::PlatformTextTrack::kind const): 25 (WebCore::PlatformTextTrack::mode const): 26 (WebCore::PlatformTextTrack::label const): 27 (WebCore::PlatformTextTrack::language const): 28 (WebCore::PlatformTextTrack::url const): 29 (WebCore::PlatformTextTrack::uniqueId const): 30 (WebCore::PlatformTextTrack::isDefault const): 31 (WebCore::PlatformTextTrack::client const): 32 (WebCore::PlatformTextTrack::data const): 33 (WebCore::PlatformTextTrack::PlatformTextTrack): 34 (WebCore::PlatformTextTrack::captionMenuOffItem): Deleted. 35 (WebCore::PlatformTextTrack::captionMenuAutomaticItem): Deleted. 36 37 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 38 (WebCore::mediaDescriptionForKind): 39 (WebCore::MediaPlayerPrivateAVFoundationObjC::synchronizeTextTrackState): 40 1 41 2020-09-28 Fujii Hironori <Hironori.Fujii@sony.com> 2 42 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r267709 r267713 6855 6855 #if ENABLE(AVF_CAPTIONS) 6856 6856 6857 static inline PlatformTextTrack ::TrackKind toPlatform(TextTrack::Kind kind)6857 static inline PlatformTextTrackData::TrackKind toPlatform(TextTrack::Kind kind) 6858 6858 { 6859 6859 switch (kind) { 6860 6860 case TextTrack::Kind::Captions: 6861 return PlatformTextTrack ::Caption;6861 return PlatformTextTrackData::TrackKind::Caption; 6862 6862 case TextTrack::Kind::Chapters: 6863 return PlatformTextTrack ::Chapter;6863 return PlatformTextTrackData::TrackKind::Chapter; 6864 6864 case TextTrack::Kind::Descriptions: 6865 return PlatformTextTrack ::Description;6865 return PlatformTextTrackData::TrackKind::Description; 6866 6866 case TextTrack::Kind::Forced: 6867 return PlatformTextTrack ::Forced;6867 return PlatformTextTrackData::TrackKind::Forced; 6868 6868 case TextTrack::Kind::Metadata: 6869 return PlatformTextTrack ::MetaData;6869 return PlatformTextTrackData::TrackKind::MetaData; 6870 6870 case TextTrack::Kind::Subtitles: 6871 return PlatformTextTrack ::Subtitle;6871 return PlatformTextTrackData::TrackKind::Subtitle; 6872 6872 } 6873 6873 ASSERT_NOT_REACHED(); 6874 return PlatformTextTrack ::Caption;6875 } 6876 6877 static inline PlatformTextTrack ::TrackMode toPlatform(TextTrack::Mode mode)6874 return PlatformTextTrackData::TrackKind::Caption; 6875 } 6876 6877 static inline PlatformTextTrackData::TrackMode toPlatform(TextTrack::Mode mode) 6878 6878 { 6879 6879 switch (mode) { 6880 6880 case TextTrack::Mode::Disabled: 6881 return PlatformTextTrack ::Disabled;6881 return PlatformTextTrackData::TrackMode::Disabled; 6882 6882 case TextTrack::Mode::Hidden: 6883 return PlatformTextTrack ::Hidden;6883 return PlatformTextTrackData::TrackMode::Hidden; 6884 6884 case TextTrack::Mode::Showing: 6885 return PlatformTextTrack ::Showing;6885 return PlatformTextTrackData::TrackMode::Showing; 6886 6886 } 6887 6887 ASSERT_NOT_REACHED(); 6888 return PlatformTextTrack ::Disabled;6888 return PlatformTextTrackData::TrackMode::Disabled; 6889 6889 } 6890 6890 -
trunk/Source/WebCore/platform/graphics/PlatformTextTrack.h
r223728 r267713 24 24 */ 25 25 26 #ifndef PlatformTextTrack_h 27 #define PlatformTextTrack_h 26 #pragma once 28 27 29 28 #if ENABLE(AVF_CAPTIONS) … … 37 36 class InbandTextTrackPrivate; 38 37 39 class PlatformTextTrackClient { 40 public: 41 virtual ~PlatformTextTrackClient() = default; 42 43 virtual TextTrack* publicTrack() = 0; 44 virtual InbandTextTrackPrivate* privateTrack() { return 0; } 45 }; 46 47 class PlatformTextTrack : public RefCounted<PlatformTextTrack> { 48 public: 49 enum TrackKind { 38 struct PlatformTextTrackData { 39 enum class TrackKind : uint8_t { 50 40 Subtitle = 0, 51 41 Caption = 1, … … 55 45 Forced = 5, 56 46 }; 57 enum TrackType{47 enum class TrackType : uint8_t { 58 48 InBand = 0, 59 49 OutOfBand = 1, 60 50 Script = 2 61 51 }; 62 enum TrackMode{52 enum class TrackMode : uint8_t { 63 53 Disabled, 64 54 Hidden, 65 55 Showing 66 56 }; 67 68 static Ref<PlatformTextTrack> create(PlatformTextTrackClient* client, const String& label, const String& language, TrackMode mode, TrackKind kind, TrackType type, int uniqueId) 69 { 70 return adoptRef(*new PlatformTextTrack(client, label, language, String(), mode, kind, type, uniqueId, false)); 71 } 72 73 static Ref<PlatformTextTrack> createOutOfBand(const String& label, const String& language, const String& url, TrackMode mode, TrackKind kind, int uniqueId, bool isDefault) 74 { 75 return adoptRef(*new PlatformTextTrack(nullptr, label, language, url, mode, kind, OutOfBand, uniqueId, isDefault)); 76 } 77 78 virtual ~PlatformTextTrack() = default; 79 80 TrackType type() const { return m_type; } 81 TrackKind kind() const { return m_kind; } 82 TrackMode mode() const { return m_mode; } 83 const String& label() const { return m_label; } 84 const String& language() const { return m_language; } 85 const String& url() const { return m_url; } 86 PlatformTextTrackClient* client() const { return m_client; } 87 int uniqueId() const { return m_uniqueId; } 88 bool isDefault() const { return m_isDefault; } 89 90 static PlatformTextTrack& captionMenuOffItem() 91 { 92 static PlatformTextTrack& off = PlatformTextTrack::create(nullptr, "off menu item", "", Showing, Subtitle, InBand, 0).leakRef(); 93 return off; 94 } 95 96 static PlatformTextTrack& captionMenuAutomaticItem() 97 { 98 static PlatformTextTrack& automatic = PlatformTextTrack::create(nullptr, "automatic menu item", "", Showing, Subtitle, InBand, 0).leakRef(); 99 return automatic; 100 } 101 102 protected: 103 PlatformTextTrack(PlatformTextTrackClient* client, const String& label, const String& language, const String& url, TrackMode mode, TrackKind kind, TrackType type, int uniqueId, bool isDefault) 57 58 PlatformTextTrackData() = default; 59 PlatformTextTrackData(const String& label, const String& language, const String& url, TrackMode mode, TrackKind kind, TrackType type, int uniqueId, bool isDefault) 104 60 : m_label(label) 105 61 , m_language(language) … … 108 64 , m_kind(kind) 109 65 , m_type(type) 110 , m_client(client)111 66 , m_uniqueId(uniqueId) 112 67 , m_isDefault(isDefault) … … 120 75 TrackKind m_kind; 121 76 TrackType m_type; 122 PlatformTextTrackClient* m_client;123 77 int m_uniqueId; 124 78 bool m_isDefault; 125 }; 126 79 80 template<class Encoder> void encode(Encoder&) const; 81 template<class Decoder> static Optional<PlatformTextTrackData> decode(Decoder&); 82 }; 83 84 template <class Decoder> 85 Optional<PlatformTextTrackData> PlatformTextTrackData::decode(Decoder& decoder) 86 { 87 Optional<String> label; 88 decoder >> label; 89 if (!label) 90 return WTF::nullopt; 91 92 Optional<String> language; 93 decoder >> language; 94 if (!language) 95 return WTF::nullopt; 96 97 Optional<String> url; 98 decoder >> url; 99 if (!url) 100 return WTF::nullopt; 101 102 Optional<TrackMode> mode; 103 decoder >> mode; 104 if (!mode) 105 return WTF::nullopt; 106 107 Optional<TrackKind> kind; 108 decoder >> kind; 109 if (!kind) 110 return WTF::nullopt; 111 112 Optional<TrackType> type; 113 decoder >> type; 114 if (!type) 115 return WTF::nullopt; 116 117 Optional<int> uniqueId; 118 decoder >> uniqueId; 119 if (!uniqueId) 120 return WTF::nullopt; 121 122 Optional<bool> isDefault; 123 decoder >> isDefault; 124 if (!isDefault) 125 return WTF::nullopt; 126 127 PlatformTextTrackData data = { 128 WTFMove(*label), 129 WTFMove(*language), 130 WTFMove(*url), 131 WTFMove(*mode), 132 WTFMove(*kind), 133 WTFMove(*type), 134 WTFMove(*uniqueId), 135 WTFMove(*isDefault), 136 }; 137 138 return data; 127 139 } 128 140 129 #endif 130 131 #endif // PlatformTextTrack_h 141 template<class Encoder> 142 void PlatformTextTrackData::encode(Encoder& encoder) const 143 { 144 encoder << m_label; 145 encoder << m_language; 146 encoder << m_url; 147 encoder << m_mode; 148 encoder << m_kind; 149 encoder << m_type; 150 encoder << m_uniqueId; 151 encoder << m_isDefault; 152 } 153 154 class PlatformTextTrackClient { 155 public: 156 virtual ~PlatformTextTrackClient() = default; 157 158 virtual TextTrack* publicTrack() = 0; 159 virtual InbandTextTrackPrivate* privateTrack() { return 0; } 160 }; 161 162 class PlatformTextTrack : public RefCounted<PlatformTextTrack> { 163 public: 164 static Ref<PlatformTextTrack> create(PlatformTextTrackClient* client, const String& label, const String& language, PlatformTextTrackData::TrackMode mode, PlatformTextTrackData::TrackKind kind, PlatformTextTrackData::TrackType type, int uniqueId) 165 { 166 return adoptRef(*new PlatformTextTrack(client, label, language, String(), mode, kind, type, uniqueId, false)); 167 } 168 169 static Ref<PlatformTextTrack> createOutOfBand(const String& label, const String& language, const String& url, PlatformTextTrackData::TrackMode mode, PlatformTextTrackData::TrackKind kind, int uniqueId, bool isDefault) 170 { 171 return adoptRef(*new PlatformTextTrack(nullptr, label, language, url, mode, kind, PlatformTextTrackData::TrackType::OutOfBand, uniqueId, isDefault)); 172 } 173 174 static Ref<PlatformTextTrack> create(PlatformTextTrackData&& data) 175 { 176 return adoptRef(*new PlatformTextTrack(WTFMove(data))); 177 } 178 179 virtual ~PlatformTextTrack() = default; 180 181 PlatformTextTrackData::TrackType type() const { return m_trackData.m_type; } 182 PlatformTextTrackData::TrackKind kind() const { return m_trackData.m_kind; } 183 PlatformTextTrackData::TrackMode mode() const { return m_trackData.m_mode; } 184 const String& label() const { return m_trackData.m_label; } 185 const String& language() const { return m_trackData.m_language; } 186 const String& url() const { return m_trackData.m_url; } 187 int uniqueId() const { return m_trackData.m_uniqueId; } 188 bool isDefault() const { return m_trackData.m_isDefault; } 189 PlatformTextTrackClient* client() const { return m_client; } 190 191 PlatformTextTrackData data() const { return m_trackData; } 192 193 protected: 194 PlatformTextTrack(PlatformTextTrackClient* client, const String& label, const String& language, const String& url, PlatformTextTrackData::TrackMode mode, PlatformTextTrackData::TrackKind kind, PlatformTextTrackData::TrackType type, int uniqueId, bool isDefault) 195 : m_client(client) 196 { 197 m_trackData = { 198 label, 199 language, 200 url, 201 mode, 202 kind, 203 type, 204 uniqueId, 205 isDefault, 206 }; 207 } 208 209 PlatformTextTrack(PlatformTextTrackData&& data) 210 : m_trackData(WTFMove(data)) 211 { 212 } 213 214 PlatformTextTrackData m_trackData; 215 PlatformTextTrackClient* m_client; 216 }; 217 218 } // namespace WebCore 219 220 namespace WTF { 221 222 template<> struct EnumTraits<WebCore::PlatformTextTrackData::TrackKind> { 223 using values = EnumValues< 224 WebCore::PlatformTextTrackData::TrackKind, 225 WebCore::PlatformTextTrackData::TrackKind::Subtitle, 226 WebCore::PlatformTextTrackData::TrackKind::Caption, 227 WebCore::PlatformTextTrackData::TrackKind::Description, 228 WebCore::PlatformTextTrackData::TrackKind::Chapter, 229 WebCore::PlatformTextTrackData::TrackKind::MetaData, 230 WebCore::PlatformTextTrackData::TrackKind::Forced 231 >; 232 }; 233 234 template<> struct EnumTraits<WebCore::PlatformTextTrackData::TrackType> { 235 using values = EnumValues< 236 WebCore::PlatformTextTrackData::TrackType, 237 WebCore::PlatformTextTrackData::TrackType::InBand, 238 WebCore::PlatformTextTrackData::TrackType::OutOfBand, 239 WebCore::PlatformTextTrackData::TrackType::Script 240 >; 241 }; 242 243 template<> struct EnumTraits<WebCore::PlatformTextTrackData::TrackMode> { 244 using values = EnumValues< 245 WebCore::PlatformTextTrackData::TrackMode, 246 WebCore::PlatformTextTrackData::TrackMode::Disabled, 247 WebCore::PlatformTextTrackData::TrackMode::Hidden, 248 WebCore::PlatformTextTrackData::TrackMode::Showing 249 >; 250 }; 251 252 } // namespace WTF 253 254 #endif // ENABLE(AVF_CAPTIONS) 255 256 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r267491 r267713 670 670 #if ENABLE(AVF_CAPTIONS) 671 671 672 static const NSArray *mediaDescriptionForKind(PlatformTextTrack ::TrackKind kind)672 static const NSArray *mediaDescriptionForKind(PlatformTextTrackData::TrackKind kind) 673 673 { 674 674 static bool manualSelectionMode = MTEnableCaption2015BehaviorPtr() && MTEnableCaption2015BehaviorPtr()(); … … 677 677 678 678 // FIXME: Match these to correct types: 679 if (kind == PlatformTextTrack ::Caption)679 if (kind == PlatformTextTrackData::TrackKind::Caption) 680 680 return @[ AVMediaCharacteristicTranscribesSpokenDialogForAccessibility ]; 681 681 682 if (kind == PlatformTextTrack ::Subtitle)682 if (kind == PlatformTextTrackData::TrackKind::Subtitle) 683 683 return @[ AVMediaCharacteristicTranscribesSpokenDialogForAccessibility ]; 684 684 685 if (kind == PlatformTextTrack ::Description)685 if (kind == PlatformTextTrackData::TrackKind::Description) 686 686 return @[ AVMediaCharacteristicTranscribesSpokenDialogForAccessibility, AVMediaCharacteristicDescribesMusicAndSoundForAccessibility ]; 687 687 688 if (kind == PlatformTextTrack ::Forced)688 if (kind == PlatformTextTrackData::TrackKind::Forced) 689 689 return @[ AVMediaCharacteristicContainsOnlyForcedSubtitles ]; 690 690 … … 699 699 void MediaPlayerPrivateAVFoundationObjC::synchronizeTextTrackState() 700 700 { 701 const Vector<RefPtr<PlatformTextTrack>>& outOfBandTrackSources = player()->outOfBandTrackSources();701 const auto& outOfBandTrackSources = player()->outOfBandTrackSources(); 702 702 703 703 for (auto& textTrack : m_textTracks) { … … 715 715 716 716 InbandTextTrackPrivate::Mode mode = InbandTextTrackPrivate::Mode::Hidden; 717 if (track->mode() == PlatformTextTrack::Hidden) 717 switch (track->mode()) { 718 case PlatformTextTrackData::TrackMode::Hidden: 718 719 mode = InbandTextTrackPrivate::Mode::Hidden; 719 else if (track->mode() == PlatformTextTrack::Disabled) 720 break; 721 case PlatformTextTrackData::TrackMode::Disabled: 720 722 mode = InbandTextTrackPrivate::Mode::Disabled; 721 else if (track->mode() == PlatformTextTrack::Showing) 723 break; 724 case PlatformTextTrackData::TrackMode::Showing: 722 725 mode = InbandTextTrackPrivate::Mode::Showing; 726 break; 727 } 723 728 724 729 textTrack->setMode(mode); -
trunk/Source/WebKit/ChangeLog
r267709 r267713 1 2020-09-28 Eric Carlson <eric.carlson@apple.com> 2 3 [GPUP] Out-of-band TextTracks 4 https://bugs.webkit.org/show_bug.cgi?id=217062 5 <rdar://problem/68739969> 6 7 Reviewed by Jer Noble. 8 9 * GPUProcess/media/RemoteMediaPlayerProxy.cpp: 10 (WebKit::RemoteMediaPlayerProxy::outOfBandTrackSources): 11 * GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h: 12 (WebKit::RemoteMediaPlayerProxyConfiguration::encode const): 13 (WebKit::RemoteMediaPlayerProxyConfiguration::decode): 14 * Scripts/webkit/messages.py: 15 * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: 16 (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer): 17 * WebProcess/GPU/media/RemoteMediaPlayerManager.h: 18 1 19 2020-09-28 Devin Rousso <drousso@apple.com> 2 20 -
trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp
r267491 r267713 658 658 Vector<RefPtr<PlatformTextTrack>> RemoteMediaPlayerProxy::outOfBandTrackSources() 659 659 { 660 notImplemented(); 661 return { }; 660 Vector<RefPtr<PlatformTextTrack>> sources; 661 for (auto& data : m_configuration.outOfBandTrackData) 662 sources.append(PlatformTextTrack::create(WTFMove(data))); 663 664 return sources; 662 665 } 663 666 -
trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h
r258082 r267713 29 29 30 30 #include <WebCore/ContentType.h> 31 #include <WebCore/PlatformTextTrack.h> 31 32 #include <WebCore/SecurityOriginData.h> 32 33 #include <wtf/text/WTFString.h> … … 41 42 Vector<WebCore::ContentType> mediaContentTypesRequiringHardwareSupport; 42 43 Vector<String> preferredAudioCharacteristics; 44 #if ENABLE(AVF_CAPTIONS) 45 Vector<WebCore::PlatformTextTrackData> outOfBandTrackData; 46 #endif 43 47 WebCore::SecurityOriginData documentSecurityOrigin; 44 48 uint64_t logIdentifier { 0 }; … … 55 59 encoder << mediaContentTypesRequiringHardwareSupport; 56 60 encoder << preferredAudioCharacteristics; 61 #if ENABLE(AVF_CAPTIONS) 62 encoder << outOfBandTrackData; 63 #endif 57 64 encoder << documentSecurityOrigin; 58 65 encoder << logIdentifier; … … 94 101 return WTF::nullopt; 95 102 103 #if ENABLE(AVF_CAPTIONS) 104 Optional<Vector<WebCore::PlatformTextTrackData>> outOfBandTrackData; 105 decoder >> outOfBandTrackData; 106 if (!outOfBandTrackData) 107 return WTF::nullopt; 108 #endif 109 96 110 Optional<WebCore::SecurityOriginData> documentSecurityOrigin; 97 111 decoder >> documentSecurityOrigin; … … 121 135 WTFMove(*mediaContentTypesRequiringHardwareSupport), 122 136 WTFMove(*preferredAudioCharacteristics), 137 #if ENABLE(AVF_CAPTIONS) 138 WTFMove(*outOfBandTrackData), 139 #endif 123 140 WTFMove(*documentSecurityOrigin), 124 141 *logIdentifier, -
trunk/Source/WebKit/Scripts/webkit/messages.py
r267156 r267713 624 624 'WebCore::PaymentAuthorizationResult': ['<WebCore/ApplePaySessionPaymentRequest.h>'], 625 625 'WebCore::PaymentMethodUpdate': ['<WebCore/ApplePaySessionPaymentRequest.h>'], 626 'WebCore::PlatformTextTrackData': ['<WebCore/PlatformTextTrack.h>'], 626 627 'WebCore::PluginInfo': ['<WebCore/PluginData.h>'], 627 628 'WebCore::PluginLoadClientPolicy': ['<WebCore/PluginData.h>'], -
trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp
r267516 r267713 143 143 std::unique_ptr<MediaPlayerPrivateInterface> RemoteMediaPlayerManager::createRemoteMediaPlayer(MediaPlayer* player, MediaPlayerEnums::MediaEngineIdentifier remoteEngineIdentifier) 144 144 { 145 146 145 RemoteMediaPlayerProxyConfiguration proxyConfiguration; 147 146 proxyConfiguration.referrer = player->referrer(); … … 159 158 proxyConfiguration.isVideo = player->isVideoPlayer(); 160 159 160 #if ENABLE(AVF_CAPTIONS) 161 for (const auto& track : player->outOfBandTrackSources()) 162 proxyConfiguration.outOfBandTrackData.append(track->data()); 163 #endif 164 161 165 auto documentSecurityOrigin = player->documentSecurityOrigin(); 162 166 proxyConfiguration.documentSecurityOrigin = documentSecurityOrigin; -
trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.h
r258122 r267713 49 49 class RemoteMediaPlayerMIMETypeCache; 50 50 class WebProcess; 51 struct PlatformTextTrackData; 51 52 struct TrackPrivateRemoteConfiguration; 52 53
Note:
See TracChangeset
for help on using the changeset viewer.