Changeset 236006 in webkit
- Timestamp:
- Sep 14, 2018 8:37:14 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r236005 r236006 1 2018-09-14 Xabier Rodriguez Calvar <calvaris@igalia.com> 2 3 [EME] Add support the waitingforkey event 4 https://bugs.webkit.org/show_bug.cgi?id=189616 5 6 Reviewed by Philippe Normand. 7 8 Crossplatform support to fire the waitingforkey event from the 9 player to the element. The element implements the W3C specified 10 algorithm. 11 12 * html/HTMLMediaElement.cpp: 13 (WebCore::HTMLMediaElement::mediaPlayerWaitingForKey): 14 (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary): 15 * html/HTMLMediaElement.h: 16 * platform/graphics/MediaPlayer.cpp: 17 (WebCore::MediaPlayer::waitingForKey): 18 * platform/graphics/MediaPlayer.h: 19 (WebCore::MediaPlayerClient::mediaPlayerWaitingForKey): 20 1 21 2018-09-14 Mike Gorse <mgorse@suse.com> 2 22 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r235752 r236006 2788 2788 } 2789 2789 2790 void HTMLMediaElement::mediaPlayerWaitingForKey() 2791 { 2792 // https://www.w3.org/TR/encrypted-media/#wait-for-key 2793 // W3C Recommendation 18 September 2017 2794 2795 // The Wait for Key algorithm queues a waitingforkey event and 2796 // updates readyState. It should only be called when the 2797 // HTMLMediaElement object is potentially playing and its 2798 // readyState is equal to HAVE_FUTURE_DATA or greater. Requests to 2799 // run this algorithm include a target HTMLMediaElement object. 2800 2801 // The following steps are run: 2802 2803 // 1. Let the media element be the specified HTMLMediaElement 2804 // object. 2805 // 2. If the media element's playback blocked waiting for key 2806 // value is true, abort these steps. 2807 if (m_playbackBlockedWaitingForKey) 2808 return; 2809 2810 // 3. Set the media element's playback blocked waiting for key 2811 // value to true. 2812 m_playbackBlockedWaitingForKey = true; 2813 2814 // NOTE 2815 // As a result of the above step, the media element will become a 2816 // blocked media element if it wasn't already. In that case, the 2817 // media element will stop playback. 2818 2819 // 4. Follow the steps for the first matching condition from the 2820 // following list: 2821 2822 // If data for the immediate current playback position is 2823 // available 2824 // Set the readyState of media element to HAVE_CURRENT_DATA. 2825 // Otherwise 2826 // Set the readyState of media element to HAVE_METADATA. 2827 ReadyState nextReadyState = buffered()->contain(currentTime()) ? HAVE_CURRENT_DATA : HAVE_METADATA; 2828 if (nextReadyState < m_readyState) 2829 setReadyState(static_cast<MediaPlayer::ReadyState>(nextReadyState)); 2830 2831 // NOTE 2832 // In other words, if the video frame and audio data for the 2833 // current playback position have been decoded because they were 2834 // unencrypted and/or successfully decrypted, set readyState to 2835 // HAVE_CURRENT_DATA. Otherwise, including if this was previously 2836 // the case but the data is no longer available, set readyState to 2837 // HAVE_METADATA. 2838 2839 // 5. Queue a task to fire a simple event named waitingforkey at the 2840 // media element. 2841 scheduleEvent(eventNames().waitingforkeyEvent); 2842 2843 // 6. Suspend playback. 2844 // GStreamer handles this without suspending explicitly. 2845 } 2846 2790 2847 void HTMLMediaElement::attemptToDecrypt() 2791 2848 { … … 2828 2885 // 1. Let the media element be the specified HTMLMediaElement object. 2829 2886 // 2. If the media element's playback blocked waiting for key is false, abort these steps. 2830 // FIXME: ^ 2887 if (!m_playbackBlockedWaitingForKey) 2888 return; 2831 2889 2832 2890 // 3. Run the Attempt to Decrypt algorithm on the media element. … … 2835 2893 // 4. If the user agent can advance the current playback position in the direction of playback: 2836 2894 // 4.1. Set the media element's decryption blocked waiting for key value to false. 2895 // FIXME: ^ 2837 2896 // 4.2. Set the media element's playback blocked waiting for key value to false. 2897 m_playbackBlockedWaitingForKey = false; 2898 2838 2899 // 4.3. Set the media element's readyState value to HAVE_CURRENT_DATA, HAVE_FUTURE_DATA or HAVE_ENOUGH_DATA as appropriate. 2839 // FIXME: ^2900 setReadyState(m_player->readyState()); 2840 2901 } 2841 2902 -
trunk/Source/WebCore/html/HTMLMediaElement.h
r235752 r236006 674 674 #if ENABLE(ENCRYPTED_MEDIA) 675 675 void mediaPlayerInitializationDataEncountered(const String&, RefPtr<ArrayBuffer>&&) final; 676 void mediaPlayerWaitingForKey() final; 676 677 677 678 void attemptToDecrypt(); … … 1149 1150 RefPtr<MediaKeys> m_mediaKeys; 1150 1151 bool m_attachingMediaKeys { false }; 1152 bool m_playbackBlockedWaitingForKey { false }; 1151 1153 GenericTaskQueue<Timer> m_encryptedMediaQueue; 1152 1154 #endif -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r234140 r236006 1267 1267 } 1268 1268 1269 void MediaPlayer::waitingForKey() 1270 { 1271 client().mediaPlayerWaitingForKey(); 1272 } 1269 1273 #endif 1270 1274 -
trunk/Source/WebCore/platform/graphics/MediaPlayer.h
r234055 r236006 170 170 #if ENABLE(ENCRYPTED_MEDIA) 171 171 virtual void mediaPlayerInitializationDataEncountered(const String&, RefPtr<ArrayBuffer>&&) { } 172 virtual void mediaPlayerWaitingForKey() { } 172 173 #endif 173 174 … … 488 489 #if ENABLE(ENCRYPTED_MEDIA) 489 490 void initializationDataEncountered(const String&, RefPtr<ArrayBuffer>&&); 491 void waitingForKey(); 490 492 #endif 491 493
Note: See TracChangeset
for help on using the changeset viewer.