Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: Source/core/html/HTMLMediaElement.h

Issue 1055503002: Eliminate MediaPlayer & MediaPlayerClient abstractions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added separate interface for EncryptedMedia Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 25
26 #ifndef HTMLMediaElement_h 26 #ifndef HTMLMediaElement_h
27 #define HTMLMediaElement_h 27 #define HTMLMediaElement_h
28 28
29 #include "core/CoreExport.h" 29 #include "core/CoreExport.h"
30 #include "core/dom/ActiveDOMObject.h" 30 #include "core/dom/ActiveDOMObject.h"
31 #include "core/events/GenericEventQueue.h" 31 #include "core/events/GenericEventQueue.h"
32 #include "core/html/HTMLElement.h" 32 #include "core/html/HTMLElement.h"
33 #include "core/html/track/TextTrack.h" 33 #include "core/html/track/TextTrack.h"
34 #include "platform/Supplementable.h" 34 #include "platform/Supplementable.h"
35 #include "platform/graphics/media/MediaPlayer.h" 35 #include "platform/audio/AudioSourceProvider.h"
36 #include "public/platform/WebAudioSourceProviderClient.h"
36 #include "public/platform/WebMediaPlayerClient.h" 37 #include "public/platform/WebMediaPlayerClient.h"
37 #include "public/platform/WebMimeRegistry.h" 38 #include "public/platform/WebMimeRegistry.h"
38 39
39 namespace blink { 40 namespace blink {
40 class WebInbandTextTrack; 41 class WebInbandTextTrack;
41 class WebLayer; 42 class WebLayer;
42 } 43 }
43 44
44 namespace blink { 45 namespace blink {
45 46
(...skipping 12 matching lines...) Expand all
58 class MediaController; 59 class MediaController;
59 class MediaControls; 60 class MediaControls;
60 class MediaError; 61 class MediaError;
61 class HTMLMediaSource; 62 class HTMLMediaSource;
62 class TextTrackContainer; 63 class TextTrackContainer;
63 class TextTrackList; 64 class TextTrackList;
64 class TimeRanges; 65 class TimeRanges;
65 class URLRegistry; 66 class URLRegistry;
66 class VideoTrackList; 67 class VideoTrackList;
67 68
68 // FIXME: The inheritance from MediaPlayerClient here should be private inherita nce. 69 // FIXME: The inheritance from MediaPlayerClient here should be private inherita nce.
philipj_slow 2015/05/06 15:39:33 This FIXME can be removed now. Yay!
Srirama 2015/05/19 10:39:46 Done.
69 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so it 70 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so it
70 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. 71 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement.
71 72
72 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupple mentable<HTMLMediaElement>, public MediaPlayerClient, public ActiveDOMObject { 73 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupple mentable<HTMLMediaElement>, public WebMediaPlayerClient, public ActiveDOMObject {
73 DEFINE_WRAPPERTYPEINFO(); 74 DEFINE_WRAPPERTYPEINFO();
74 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement); 75 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement);
75 public: 76 public:
76 static blink::WebMimeRegistry::SupportsType supportsType(const ContentType&, const String& keySystem = String()); 77 static blink::WebMimeRegistry::SupportsType supportsType(const ContentType&, const String& keySystem = String());
77 78
78 static void setMediaStreamRegistry(URLRegistry*); 79 static void setMediaStreamRegistry(URLRegistry*);
79 static bool isMediaStreamURL(const String& url); 80 static bool isMediaStreamURL(const String& url);
80 81
81 DECLARE_VIRTUAL_TRACE(); 82 DECLARE_VIRTUAL_TRACE();
82 #if ENABLE(WEB_AUDIO) 83 #if ENABLE(WEB_AUDIO)
83 void clearWeakMembers(Visitor*); 84 void clearWeakMembers(Visitor*);
84 #endif 85 #endif
85 blink::WebMediaPlayer* webMediaPlayer() const { return m_player ? m_player-> webMediaPlayer() : 0; } 86 blink::WebMediaPlayer* webMediaPlayer() const
philipj_slow 2015/05/06 15:39:33 blink:: prefix not needed: https://codereview.chro
Srirama 2015/05/19 10:39:47 Done.
87 {
88 return m_webMediaPlayer.get();
89 }
86 90
87 virtual bool hasVideo() const { return false; } 91 virtual bool hasVideo() const { return false; }
88 bool hasAudio() const; 92 bool hasAudio() const;
89 93
90 bool supportsSave() const; 94 bool supportsSave() const;
91 95
92 blink::WebLayer* platformLayer() const; 96 blink::WebLayer* platformLayer() const;
93 97
94 enum DelayedActionType { 98 enum DelayedActionType {
95 LoadMediaResource = 1 << 0, 99 LoadMediaResource = 1 << 0,
96 LoadTextTrackResource = 1 << 1, 100 LoadTextTrackResource = 1 << 1,
97 TextTrackChangesNotification = 1 << 2 101 TextTrackChangesNotification = 1 << 2
98 }; 102 };
99 void scheduleDelayedAction(DelayedActionType); 103 void scheduleDelayedAction(DelayedActionType);
100 104
101 bool hasRemoteRoutes() const { return m_remoteRoutesAvailable; } 105 bool hasRemoteRoutes() const { return m_remoteRoutesAvailable; }
102 bool isPlayingRemotely() const { return m_playingRemotely; } 106 bool isPlayingRemotely() const { return m_playingRemotely; }
103 107
104 // error state 108 // error state
105 PassRefPtrWillBeRawPtr<MediaError> error() const; 109 PassRefPtrWillBeRawPtr<MediaError> error() const;
106 110
107 // network state 111 // network state
108 void setSrc(const AtomicString&); 112 void setSrc(const AtomicString&);
109 const KURL& currentSrc() const { return m_currentSrc; } 113 const KURL& currentSrc() const { return m_currentSrc; }
110 114
111 enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO _SOURCE }; 115 enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO _SOURCE };
112 NetworkState networkState() const; 116 NetworkState networkState() const;
113 117
114 String preload() const; 118 String preload() const;
115 MediaPlayer::Preload preloadType() const { return m_preload; } 119 WebMediaPlayer::Preload preloadType() const { return m_preload; }
116 void setPreload(const AtomicString&); 120 void setPreload(const AtomicString&);
117 121
118 PassRefPtrWillBeRawPtr<TimeRanges> buffered() const; 122 PassRefPtrWillBeRawPtr<TimeRanges> buffered() const;
119 void load(); 123 void load();
120 String canPlayType(const String& mimeType, const String& keySystem = String( )) const; 124 String canPlayType(const String& mimeType, const String& keySystem = String( )) const;
121 125
122 // ready state 126 // ready state
123 enum ReadyState { HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTUR E_DATA, HAVE_ENOUGH_DATA }; 127 enum ReadyState { HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTUR E_DATA, HAVE_ENOUGH_DATA };
124 ReadyState readyState() const; 128 ReadyState readyState() const;
125 bool seeking() const; 129 bool seeking() const;
(...skipping 18 matching lines...) Expand all
144 void pause(); 148 void pause();
145 void requestRemotePlayback(); 149 void requestRemotePlayback();
146 void requestRemotePlaybackControl(); 150 void requestRemotePlaybackControl();
147 151
148 // statistics 152 // statistics
149 unsigned webkitAudioDecodedByteCount() const; 153 unsigned webkitAudioDecodedByteCount() const;
150 unsigned webkitVideoDecodedByteCount() const; 154 unsigned webkitVideoDecodedByteCount() const;
151 155
152 // media source extensions 156 // media source extensions
153 void closeMediaSource(); 157 void closeMediaSource();
154 void durationChanged(double duration, bool requestSeek); 158 void mediaPlayerDurationChanged(double duration, bool requestSeek);
155 159
156 // controls 160 // controls
157 bool shouldShowControls() const; 161 bool shouldShowControls() const;
158 double volume() const; 162 double volume() const;
159 void setVolume(double, ExceptionState&); 163 void setVolume(double, ExceptionState&);
160 bool muted() const; 164 bool muted() const;
161 void setMuted(bool); 165 void setMuted(bool);
162 166
163 // play/pause toggling that uses the media controller if present. togglePlay StateWillPlay() is 167 // play/pause toggling that uses the media controller if present. togglePlay StateWillPlay() is
164 // true if togglePlayState() will call play() or unpause() on the media elem ent or controller. 168 // true if togglePlayState() will call play() or unpause() on the media elem ent or controller.
165 bool togglePlayStateWillPlay() const; 169 bool togglePlayStateWillPlay() const;
166 void togglePlayState(); 170 void togglePlayState();
167 171
168 AudioTrackList& audioTracks(); 172 AudioTrackList& audioTracks();
169 void audioTrackChanged(); 173 void audioTrackChanged();
170 174
171 VideoTrackList& videoTracks(); 175 VideoTrackList& videoTracks();
172 void selectedVideoTrackChanged(blink::WebMediaPlayer::TrackId*); 176 void selectedVideoTrackChanged(blink::WebMediaPlayer::TrackId*);
173 177
174 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, con st AtomicString& label, const AtomicString& language, ExceptionState&); 178 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, con st AtomicString& label, const AtomicString& language, ExceptionState&);
175 179
176 TextTrackList* textTracks(); 180 TextTrackList* textTracks();
177 CueTimeline& cueTimeline(); 181 CueTimeline& cueTimeline();
178 182
179 void addTextTrack(TextTrack*); 183 void mediaPlayerAddTextTrack(TextTrack*);
180 void removeTextTrack(TextTrack*); 184 void mediaPlayerRemoveTextTrack(TextTrack*);
181 void textTracksChanged(); 185 void textTracksChanged();
182 void notifyMediaPlayerOfTextTrackChanges(); 186 void notifyMediaPlayerOfTextTrackChanges();
183 187
184 // Implements the "forget the media element's media-resource-specific tracks " algorithm in the HTML5 spec. 188 // Implements the "forget the media element's media-resource-specific tracks " algorithm in the HTML5 spec.
185 void forgetResourceSpecificTracks(); 189 void forgetResourceSpecificTracks();
186 190
187 void didAddTrackElement(HTMLTrackElement*); 191 void didAddTrackElement(HTMLTrackElement*);
188 void didRemoveTrackElement(HTMLTrackElement*); 192 void didRemoveTrackElement(HTMLTrackElement*);
189 193
190 blink::WebMediaPlayer::TrackId addAudioTrack(const String& id, blink::WebMed iaPlayerClient::AudioTrackKind, const AtomicString& label, const AtomicString& l anguage, bool enabled);
191 void removeAudioTrack(blink::WebMediaPlayer::TrackId);
192 blink::WebMediaPlayer::TrackId addVideoTrack(const String& id, blink::WebMed iaPlayerClient::VideoTrackKind, const AtomicString& label, const AtomicString& l anguage, bool selected);
193 void removeVideoTrack(blink::WebMediaPlayer::TrackId);
194
195 virtual void mediaPlayerDidAddTextTrack(blink::WebInbandTextTrack*) override final;
196 virtual void mediaPlayerDidRemoveTextTrack(blink::WebInbandTextTrack*) overr ide final;
197 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d epend on it. 194 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d epend on it.
198 virtual KURL mediaPlayerPosterURL() override { return KURL(); } 195 virtual KURL mediaPlayerPosterURL() { return KURL(); }
199 196
200 void honorUserPreferencesForAutomaticTextTrackSelection(); 197 void honorUserPreferencesForAutomaticTextTrackSelection();
201 198
202 bool textTracksAreReady() const; 199 bool textTracksAreReady() const;
203 enum VisibilityChangeAssumption { 200 enum VisibilityChangeAssumption {
204 AssumeNoVisibleChange, 201 AssumeNoVisibleChange,
205 AssumeVisibleChange 202 AssumeVisibleChange
206 }; 203 };
207 void configureTextTrackDisplay(VisibilityChangeAssumption); 204 void configureTextTrackDisplay(VisibilityChangeAssumption);
208 void updateTextTrackDisplay(); 205 void updateTextTrackDisplay();
209 double lastSeekTime() const { return m_lastSeekTime; } 206 double lastSeekTime() const { return m_lastSeekTime; }
210 void textTrackReadyStateChanged(TextTrack*); 207 void textTrackReadyStateChanged(TextTrack*);
211 208
212 void textTrackModeChanged(TextTrack*); 209 void textTrackModeChanged(TextTrack*);
213 210
214 // EventTarget function. 211 // EventTarget function.
215 // Both Node (via HTMLElement) and ActiveDOMObject define this method, which 212 // Both Node (via HTMLElement) and ActiveDOMObject define this method, which
216 // causes an ambiguity error at compile time. This class's constructor 213 // causes an ambiguity error at compile time. This class's constructor
217 // ensures that both implementations return document, so return the result 214 // ensures that both implementations return document, so return the result
218 // of one of them here. 215 // of one of them here.
219 using HTMLElement::executionContext; 216 using HTMLElement::executionContext;
220 217
221 bool hasSingleSecurityOrigin() const { return !m_player || (webMediaPlayer() && webMediaPlayer()->hasSingleSecurityOrigin()); } 218 bool hasSingleSecurityOrigin() const { return webMediaPlayer() && webMediaPl ayer()->hasSingleSecurityOrigin(); }
philipj_slow 2015/05/06 15:39:33 I think we've discussed this in another review. Th
Srirama 2015/05/19 10:39:46 Acknowledged.
222 219
223 bool isFullscreen() const; 220 bool isFullscreen() const;
224 void enterFullscreen(); 221 void enterFullscreen();
225 void exitFullscreen(); 222 void exitFullscreen();
226 223
227 bool hasClosedCaptions() const; 224 bool hasClosedCaptions() const;
228 bool closedCaptionsVisible() const; 225 bool closedCaptionsVisible() const;
229 void setClosedCaptionsVisible(bool); 226 void setClosedCaptionsVisible(bool);
230 227
231 void remoteRouteAvailabilityChanged(bool);
232 void connectedToRemoteDevice();
233 void disconnectedFromRemoteDevice();
234
235 // Returns the MediaControls, or null if they have not been added yet. 228 // Returns the MediaControls, or null if they have not been added yet.
236 // Note that this can be non-null even if there is no controls attribute. 229 // Note that this can be non-null even if there is no controls attribute.
237 MediaControls* mediaControls() const; 230 MediaControls* mediaControls() const;
238 231
239 // Notifies the media element that the media controls became visible, so 232 // Notifies the media element that the media controls became visible, so
240 // that text track layout may be updated to avoid overlapping them. 233 // that text track layout may be updated to avoid overlapping them.
241 void mediaControlsDidBecomeVisible(); 234 void mediaControlsDidBecomeVisible();
242 235
243 void sourceWasRemoved(HTMLSourceElement*); 236 void sourceWasRemoved(HTMLSourceElement*);
244 void sourceWasAdded(HTMLSourceElement*); 237 void sourceWasAdded(HTMLSourceElement*);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 virtual void defaultEventHandler(Event*) override final; 316 virtual void defaultEventHandler(Event*) override final;
324 317
325 // ActiveDOMObject functions. 318 // ActiveDOMObject functions.
326 virtual void stop() override final; 319 virtual void stop() override final;
327 320
328 virtual void updateDisplayState() { } 321 virtual void updateDisplayState() { }
329 322
330 void setReadyState(ReadyState); 323 void setReadyState(ReadyState);
331 void setNetworkState(blink::WebMediaPlayer::NetworkState); 324 void setNetworkState(blink::WebMediaPlayer::NetworkState);
332 325
333 virtual void mediaPlayerNetworkStateChanged() override final; 326 virtual void networkStateChanged() override final;
334 virtual void mediaPlayerReadyStateChanged() override final; 327 virtual void readyStateChanged() override final;
335 virtual void mediaPlayerTimeChanged() override final; 328 virtual void timeChanged() override final;
336 virtual void mediaPlayerDurationChanged() override final; 329 virtual void repaint() override final;
337 virtual void mediaPlayerPlaybackStateChanged() override final; 330 virtual void durationChanged() override final;
338 virtual void mediaPlayerRequestFullscreen() override final; 331 virtual void sizeChanged() override final;
339 virtual void mediaPlayerRequestSeek(double) override final; 332 virtual void playbackStateChanged() override final;
340 virtual void mediaPlayerRepaint() override final; 333
341 virtual void mediaPlayerSizeChanged() override final; 334 virtual void setWebLayer(blink::WebLayer*) override final;
342 virtual void mediaPlayerSetWebLayer(blink::WebLayer*) override final; 335 virtual blink::WebMediaPlayer::TrackId addAudioTrack(const WebString&, blink ::WebMediaPlayerClient::AudioTrackKind, const WebString&, const WebString&, bool ) override final;
343 virtual void mediaPlayerMediaSourceOpened(blink::WebMediaSource*) override f inal; 336 virtual void removeAudioTrack(blink::WebMediaPlayer::TrackId) override final ;
337 virtual blink::WebMediaPlayer::TrackId addVideoTrack(const WebString&, blink ::WebMediaPlayerClient::VideoTrackKind, const WebString&, const WebString&, bool ) override final;
338 virtual void removeVideoTrack(blink::WebMediaPlayer::TrackId) override final ;
339 virtual void addTextTrack(blink::WebInbandTextTrack*) override final;
340 virtual void removeTextTrack(blink::WebInbandTextTrack*) override final;
341 virtual void mediaSourceOpened(blink::WebMediaSource*) override final;
342 virtual void requestFullscreen() override final;
343 virtual void requestSeek(double) override final;
344 virtual void remoteRouteAvailabilityChanged(bool) override final;
345 virtual void connectedToRemoteDevice() override final;
346 virtual void disconnectedFromRemoteDevice() override final;
344 347
345 void loadTimerFired(Timer<HTMLMediaElement>*); 348 void loadTimerFired(Timer<HTMLMediaElement>*);
346 void progressEventTimerFired(Timer<HTMLMediaElement>*); 349 void progressEventTimerFired(Timer<HTMLMediaElement>*);
347 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); 350 void playbackProgressTimerFired(Timer<HTMLMediaElement>*);
348 void startPlaybackProgressTimer(); 351 void startPlaybackProgressTimer();
349 void startProgressEventTimer(); 352 void startProgressEventTimer();
350 void stopPeriodicTimers(); 353 void stopPeriodicTimers();
351 354
352 void seek(double time); 355 void seek(double time);
353 void finishSeek(); 356 void finishSeek();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 // addAudioTrack() and addVideoTrack(). 448 // addAudioTrack() and addVideoTrack().
446 // FIXME: Remove this once all WebMediaPlayer implementations properly repor t their track info. 449 // FIXME: Remove this once all WebMediaPlayer implementations properly repor t their track info.
447 void createPlaceholderTracksIfNecessary(); 450 void createPlaceholderTracksIfNecessary();
448 451
449 // Sets the selected/enabled tracks if they aren't set before we initially 452 // Sets the selected/enabled tracks if they aren't set before we initially
450 // transition to HAVE_METADATA. 453 // transition to HAVE_METADATA.
451 void selectInitialTracksIfNecessary(); 454 void selectInitialTracksIfNecessary();
452 455
453 void audioTracksTimerFired(Timer<HTMLMediaElement>*); 456 void audioTracksTimerFired(Timer<HTMLMediaElement>*);
454 457
458 void loadMediaPlayer(const WTF::String& url);
459
455 Timer<HTMLMediaElement> m_loadTimer; 460 Timer<HTMLMediaElement> m_loadTimer;
456 Timer<HTMLMediaElement> m_progressEventTimer; 461 Timer<HTMLMediaElement> m_progressEventTimer;
457 Timer<HTMLMediaElement> m_playbackProgressTimer; 462 Timer<HTMLMediaElement> m_playbackProgressTimer;
458 Timer<HTMLMediaElement> m_audioTracksTimer; 463 Timer<HTMLMediaElement> m_audioTracksTimer;
459 RefPtrWillBeMember<TimeRanges> m_playedTimeRanges; 464 RefPtrWillBeMember<TimeRanges> m_playedTimeRanges;
460 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; 465 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue;
461 466
462 double m_playbackRate; 467 double m_playbackRate;
463 double m_defaultPlaybackRate; 468 double m_defaultPlaybackRate;
464 NetworkState m_networkState; 469 NetworkState m_networkState;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 WaitingForStopDelayingLoadEventTask, 505 WaitingForStopDelayingLoadEventTask,
501 // The load is the deferred, and waiting for a triggering event. 506 // The load is the deferred, and waiting for a triggering event.
502 WaitingForTrigger, 507 WaitingForTrigger,
503 // The load is deferred, and waiting for the task to set the 508 // The load is deferred, and waiting for the task to set the
504 // delaying-the-load-event flag, after which the load will be executed. 509 // delaying-the-load-event flag, after which the load will be executed.
505 ExecuteOnStopDelayingLoadEventTask 510 ExecuteOnStopDelayingLoadEventTask
506 }; 511 };
507 DeferredLoadState m_deferredLoadState; 512 DeferredLoadState m_deferredLoadState;
508 Timer<HTMLMediaElement> m_deferredLoadTimer; 513 Timer<HTMLMediaElement> m_deferredLoadTimer;
509 514
510 OwnPtr<MediaPlayer> m_player;
511 blink::WebLayer* m_webLayer; 515 blink::WebLayer* m_webLayer;
512 516
513 MediaPlayer::Preload m_preload; 517 WebMediaPlayer::Preload m_preload;
514 518
515 DisplayMode m_displayMode; 519 DisplayMode m_displayMode;
516 520
517 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; 521 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource;
518 522
519 // Cached time value. Only valid when ready state is HAVE_METADATA or 523 // Cached time value. Only valid when ready state is HAVE_METADATA or
520 // higher, otherwise the current time is assumed to be zero. 524 // higher, otherwise the current time is assumed to be zero.
521 mutable double m_cachedTime; 525 mutable double m_cachedTime;
522 526
523 double m_fragmentEndTime; 527 double m_fragmentEndTime;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 RefPtrWillBeMember<TextTrackList> m_textTracks; 568 RefPtrWillBeMember<TextTrackList> m_textTracks;
565 WillBeHeapVector<RefPtrWillBeMember<TextTrack>> m_textTracksWhenResourceSele ctionBegan; 569 WillBeHeapVector<RefPtrWillBeMember<TextTrack>> m_textTracksWhenResourceSele ctionBegan;
566 570
567 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; 571 OwnPtrWillBeMember<CueTimeline> m_cueTimeline;
568 572
569 #if ENABLE(WEB_AUDIO) 573 #if ENABLE(WEB_AUDIO)
570 // This is a weak reference, since m_audioSourceNode holds a reference to us . 574 // This is a weak reference, since m_audioSourceNode holds a reference to us .
571 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem. 575 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem.
572 GC_PLUGIN_IGNORE("http://crbug.com/404577") 576 GC_PLUGIN_IGNORE("http://crbug.com/404577")
573 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; 577 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode;
578
579 // AudioClientImpl wraps an AudioSourceProviderClient.
580 // When the audio format is known, Chromium calls setFormat().
581
582 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm pl>, public WebAudioSourceProviderClient {
583 public:
584 explicit AudioClientImpl(AudioSourceProviderClient* client)
585 : m_client(client)
586 {
587 }
588
589 virtual ~AudioClientImpl() { }
590
591 // WebAudioSourceProviderClient
592 virtual void setFormat(size_t numberOfChannels, float sampleRate) overri de;
593
594 DECLARE_TRACE();
595
596 private:
597 Member<AudioSourceProviderClient> m_client;
598 };
599
600 // AudioSourceProviderImpl wraps a WebAudioSourceProvider.
601 // provideInput() calls into Chromium to get a rendered audio stream.
602
603 class AudioSourceProviderImpl final : public AudioSourceProvider {
604 public:
605 AudioSourceProviderImpl()
606 : m_webAudioSourceProvider(0)
607 {
608 }
609
610 virtual ~AudioSourceProviderImpl() { }
611
612 // Wraps the given WebAudioSourceProvider.
613 void wrap(WebAudioSourceProvider*);
614
615 // AudioSourceProvider
616 virtual void setClient(AudioSourceProviderClient*) override;
617 virtual void provideInput(AudioBus*, size_t framesToProcess) override;
618
619 private:
620 WebAudioSourceProvider* m_webAudioSourceProvider;
621 Persistent<AudioClientImpl> m_client;
622 Mutex provideInputLock;
623 };
624
625 AudioSourceProviderImpl m_audioSourceProvider;
574 #endif 626 #endif
575 627
576 friend class MediaController; 628 friend class MediaController;
577 RefPtrWillBeMember<MediaController> m_mediaController; 629 RefPtrWillBeMember<MediaController> m_mediaController;
630 OwnPtr<WebMediaPlayer> m_webMediaPlayer;
philipj_slow 2015/05/06 15:39:33 Putting this where m_player was would be better I
Srirama 2015/05/19 10:39:46 Done.
578 631
579 friend class Internals; 632 friend class Internals;
580 friend class TrackDisplayUpdateScope; 633 friend class TrackDisplayUpdateScope;
581 634
582 static URLRegistry* s_mediaStreamRegistry; 635 static URLRegistry* s_mediaStreamRegistry;
583 }; 636 };
584 637
585 inline bool isHTMLMediaElement(const HTMLElement& element) 638 inline bool isHTMLMediaElement(const HTMLElement& element)
586 { 639 {
587 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 640 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
588 } 641 }
589 642
590 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 643 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
591 644
592 } // namespace blink 645 } // namespace blink
593 646
594 #endif // HTMLMediaElement_h 647 #endif // HTMLMediaElement_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/HTMLMediaElement.cpp » ('j') | Source/core/html/HTMLMediaElement.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698