Chromium Code Reviews| Index: Source/core/html/HTMLMediaElement.h |
| diff --git a/Source/core/html/HTMLMediaElement.h b/Source/core/html/HTMLMediaElement.h |
| index db317f5f58a4b61e62358f652528ffa95fa168b4..79fe4af4d0e0c24e3a72e3ca81a814d07b689fe4 100644 |
| --- a/Source/core/html/HTMLMediaElement.h |
| +++ b/Source/core/html/HTMLMediaElement.h |
| @@ -32,7 +32,8 @@ |
| #include "core/html/HTMLElement.h" |
| #include "core/html/track/TextTrack.h" |
| #include "platform/Supplementable.h" |
| -#include "platform/graphics/media/MediaPlayer.h" |
| +#include "platform/audio/AudioSourceProvider.h" |
| +#include "public/platform/WebAudioSourceProviderClient.h" |
| #include "public/platform/WebMediaPlayerClient.h" |
| #include "public/platform/WebMimeRegistry.h" |
| @@ -65,11 +66,7 @@ class TimeRanges; |
| class URLRegistry; |
| class VideoTrackList; |
| -// FIXME: The inheritance from MediaPlayerClient here should be private inheritance. |
| -// But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so it |
| -// no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. |
| - |
| -class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupplementable<HTMLMediaElement>, public MediaPlayerClient, public ActiveDOMObject { |
| +class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupplementable<HTMLMediaElement>, public WebMediaPlayerClient, public ActiveDOMObject { |
| DEFINE_WRAPPERTYPEINFO(); |
| WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement); |
| WILL_BE_USING_PRE_FINALIZER(HTMLMediaElement, dispose); |
| @@ -83,7 +80,10 @@ public: |
| #if ENABLE(WEB_AUDIO) |
| void clearWeakMembers(Visitor*); |
| #endif |
| - WebMediaPlayer* webMediaPlayer() const { return m_player ? m_player->webMediaPlayer() : 0; } |
| + WebMediaPlayer* webMediaPlayer() const |
| + { |
| + return m_webMediaPlayer.get(); |
| + } |
| virtual bool hasVideo() const { return false; } |
| bool hasAudio() const; |
| @@ -113,7 +113,7 @@ public: |
| NetworkState networkState() const; |
| String preload() const; |
| - MediaPlayer::Preload effectivePreloadType() const; |
| + WebMediaPlayer::Preload effectivePreloadType() const; |
| void setPreload(const AtomicString&); |
| PassRefPtrWillBeRawPtr<TimeRanges> buffered() const; |
| @@ -152,7 +152,7 @@ public: |
| // media source extensions |
| void closeMediaSource(); |
| - void durationChanged(double duration, bool requestSeek); |
| + void mediaPlayerDurationChanged(double duration, bool requestSeek); |
|
philipj_slow
2015/07/01 13:49:19
It doesn't look like this name change is necessary
Srirama
2015/07/03 12:59:02
Done.
|
| // controls |
| bool shouldShowControls() const; |
| @@ -177,8 +177,8 @@ public: |
| TextTrackList* textTracks(); |
| CueTimeline& cueTimeline(); |
| - void addTextTrack(TextTrack*); |
| - void removeTextTrack(TextTrack*); |
| + void mediaPlayerAddTextTrack(TextTrack*); |
|
philipj_slow
2015/07/01 13:49:19
I tried undoing these name changes and it compiles
Srirama
2015/07/03 12:59:02
Done.
|
| + void mediaPlayerRemoveTextTrack(TextTrack*); |
| void textTracksChanged(); |
| void notifyMediaPlayerOfTextTrackChanges(); |
| @@ -187,16 +187,8 @@ public: |
| void didAddTrackElement(HTMLTrackElement*); |
| void didRemoveTrackElement(HTMLTrackElement*); |
| - |
| - WebMediaPlayer::TrackId addAudioTrack(const String& id, WebMediaPlayerClient::AudioTrackKind, const AtomicString& label, const AtomicString& language, bool enabled); |
| - void removeAudioTrack(WebMediaPlayer::TrackId); |
| - WebMediaPlayer::TrackId addVideoTrack(const String& id, WebMediaPlayerClient::VideoTrackKind, const AtomicString& label, const AtomicString& language, bool selected); |
| - void removeVideoTrack(WebMediaPlayer::TrackId); |
| - |
| - virtual void mediaPlayerDidAddTextTrack(WebInbandTextTrack*) override final; |
| - virtual void mediaPlayerDidRemoveTextTrack(WebInbandTextTrack*) override final; |
| - // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not depend on it. |
| - virtual KURL mediaPlayerPosterURL() override { return KURL(); } |
| + // FIXME: Remove this when prepareAndLoadMediaPlayer() does not depend on it. |
| + virtual KURL mediaPlayerPosterURL() { return KURL(); } |
|
philipj_slow
2015/07/01 13:49:19
This FIXME doesn't seem like it's actually going t
Srirama
2015/07/03 12:59:02
Done.
|
| void honorUserPreferencesForAutomaticTextTrackSelection(); |
| @@ -219,7 +211,7 @@ public: |
| // of one of them here. |
| using HTMLElement::executionContext; |
| - bool hasSingleSecurityOrigin() const { return !m_player || (webMediaPlayer() && webMediaPlayer()->hasSingleSecurityOrigin()); } |
| + bool hasSingleSecurityOrigin() const { return webMediaPlayer() && webMediaPlayer()->hasSingleSecurityOrigin(); } |
| bool isFullscreen() const; |
| void enterFullscreen(); |
| @@ -229,10 +221,6 @@ public: |
| bool closedCaptionsVisible() const; |
| void setClosedCaptionsVisible(bool); |
| - void remoteRouteAvailabilityChanged(bool); |
| - void connectedToRemoteDevice(); |
| - void disconnectedFromRemoteDevice(); |
| - |
| // Returns the MediaControls, or null if they have not been added yet. |
| // Note that this can be non-null even if there is no controls attribute. |
| MediaControls* mediaControls() const; |
| @@ -252,7 +240,7 @@ public: |
| AudioSourceProviderClient* audioSourceNode() { return m_audioSourceNode; } |
| void setAudioSourceNode(AudioSourceProviderClient*); |
| - AudioSourceProvider* audioSourceProvider(); |
| + AudioSourceProvider* audioSourceProvider() { return &m_audioSourceProvider; } |
| #endif |
| enum InvalidURLAction { DoNothing, Complain }; |
| @@ -336,16 +324,26 @@ private: |
| void setReadyState(ReadyState); |
| void setNetworkState(WebMediaPlayer::NetworkState); |
| - virtual void mediaPlayerNetworkStateChanged() override final; |
| - virtual void mediaPlayerReadyStateChanged() override final; |
| - virtual void mediaPlayerTimeChanged() override final; |
| - virtual void mediaPlayerDurationChanged() override final; |
| - virtual void mediaPlayerPlaybackStateChanged() override final; |
| + virtual void networkStateChanged() override final; |
| + virtual void readyStateChanged() override final; |
| + virtual void timeChanged() override final; |
| + virtual void repaint() override final; |
| + virtual void durationChanged() override final; |
| + virtual void sizeChanged() override final; |
| + virtual void playbackStateChanged() override final; |
| + |
| + virtual void setWebLayer(WebLayer*) override final; |
| + virtual WebMediaPlayer::TrackId addAudioTrack(const WebString&, WebMediaPlayerClient::AudioTrackKind, const WebString&, const WebString&, bool) override final; |
| + virtual void removeAudioTrack(WebMediaPlayer::TrackId) override final; |
| + virtual WebMediaPlayer::TrackId addVideoTrack(const WebString&, WebMediaPlayerClient::VideoTrackKind, const WebString&, const WebString&, bool) override final; |
| + virtual void removeVideoTrack(WebMediaPlayer::TrackId) override final; |
| + virtual void addTextTrack(WebInbandTextTrack*) override final; |
| + virtual void removeTextTrack(WebInbandTextTrack*) override final; |
| + virtual void mediaSourceOpened(WebMediaSource*) override final; |
| virtual void mediaPlayerRequestSeek(double) override final; |
| - virtual void mediaPlayerRepaint() override final; |
| - virtual void mediaPlayerSizeChanged() override final; |
| - virtual void mediaPlayerSetWebLayer(WebLayer*) override final; |
| - virtual void mediaPlayerMediaSourceOpened(WebMediaSource*) override final; |
| + virtual void remoteRouteAvailabilityChanged(bool) override final; |
| + virtual void connectedToRemoteDevice() override final; |
| + virtual void disconnectedFromRemoteDevice() override final; |
| void loadTimerFired(Timer<HTMLMediaElement>*); |
| void progressEventTimerFired(Timer<HTMLMediaElement>*); |
| @@ -457,6 +455,8 @@ private: |
| void audioTracksTimerFired(Timer<HTMLMediaElement>*); |
| + void prepareAndLoadMediaPlayer(const WTF::String& url); |
|
philipj_slow
2015/07/01 13:49:19
The WTF:: prefix ought not be needed here.
Srirama
2015/07/03 12:59:02
Removed the function
|
| + |
| Timer<HTMLMediaElement> m_loadTimer; |
| Timer<HTMLMediaElement> m_progressEventTimer; |
| Timer<HTMLMediaElement> m_playbackProgressTimer; |
| @@ -512,10 +512,10 @@ private: |
| DeferredLoadState m_deferredLoadState; |
| Timer<HTMLMediaElement> m_deferredLoadTimer; |
| - OwnPtr<MediaPlayer> m_player; |
| + OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
| WebLayer* m_webLayer; |
| - MediaPlayer::Preload m_preload; |
| + WebMediaPlayer::Preload m_preload; |
| DisplayMode m_displayMode; |
| @@ -576,6 +576,54 @@ private: |
| // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem. |
| GC_PLUGIN_IGNORE("http://crbug.com/404577") |
| RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; |
| + |
| + // AudioClientImpl wraps an AudioSourceProviderClient. |
| + // When the audio format is known, Chromium calls setFormat(). |
| + |
| + class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientImpl>, public WebAudioSourceProviderClient { |
| + public: |
| + explicit AudioClientImpl(AudioSourceProviderClient* client) |
| + : m_client(client) |
| + { |
| + } |
| + |
| + virtual ~AudioClientImpl() { } |
| + |
| + // WebAudioSourceProviderClient |
| + virtual void setFormat(size_t numberOfChannels, float sampleRate) override; |
| + |
| + DECLARE_TRACE(); |
| + |
| + private: |
| + Member<AudioSourceProviderClient> m_client; |
| + }; |
| + |
| + // AudioSourceProviderImpl wraps a WebAudioSourceProvider. |
| + // provideInput() calls into Chromium to get a rendered audio stream. |
| + |
| + class AudioSourceProviderImpl final : public AudioSourceProvider { |
| + public: |
| + AudioSourceProviderImpl() |
| + : m_webAudioSourceProvider(0) |
| + { |
| + } |
| + |
| + virtual ~AudioSourceProviderImpl() { } |
| + |
| + // Wraps the given WebAudioSourceProvider. |
| + void wrap(WebAudioSourceProvider*); |
| + |
| + // AudioSourceProvider |
| + virtual void setClient(AudioSourceProviderClient*) override; |
| + virtual void provideInput(AudioBus*, size_t framesToProcess) override; |
| + |
| + private: |
| + WebAudioSourceProvider* m_webAudioSourceProvider; |
| + Persistent<AudioClientImpl> m_client; |
| + Mutex provideInputLock; |
| + }; |
| + |
| + AudioSourceProviderImpl m_audioSourceProvider; |
| #endif |
| friend class MediaController; |