| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 #include "platform/audio/AudioSourceProviderClient.h" | 82 #include "platform/audio/AudioSourceProviderClient.h" |
| 83 #include "platform/graphics/GraphicsLayer.h" | 83 #include "platform/graphics/GraphicsLayer.h" |
| 84 #include "platform/mediastream/MediaStreamDescriptor.h" | 84 #include "platform/mediastream/MediaStreamDescriptor.h" |
| 85 #include "platform/weborigin/SecurityOrigin.h" | 85 #include "platform/weborigin/SecurityOrigin.h" |
| 86 #include "public/platform/Platform.h" | 86 #include "public/platform/Platform.h" |
| 87 #include "public/platform/WebAudioSourceProvider.h" | 87 #include "public/platform/WebAudioSourceProvider.h" |
| 88 #include "public/platform/WebContentDecryptionModule.h" | 88 #include "public/platform/WebContentDecryptionModule.h" |
| 89 #include "public/platform/WebInbandTextTrack.h" | 89 #include "public/platform/WebInbandTextTrack.h" |
| 90 #include "public/platform/WebMediaPlayerSource.h" | 90 #include "public/platform/WebMediaPlayerSource.h" |
| 91 #include "public/platform/WebMediaStream.h" | 91 #include "public/platform/WebMediaStream.h" |
| 92 #include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h
" |
| 92 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" | 93 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" |
| 93 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" | 94 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" |
| 94 #include "wtf/CurrentTime.h" | 95 #include "wtf/CurrentTime.h" |
| 95 #include "wtf/MathExtras.h" | 96 #include "wtf/MathExtras.h" |
| 96 #include "wtf/PtrUtil.h" | 97 #include "wtf/PtrUtil.h" |
| 97 #include "wtf/text/CString.h" | 98 #include "wtf/text/CString.h" |
| 98 #include <limits> | 99 #include <limits> |
| 99 | 100 |
| 100 #ifndef BLINK_MEDIA_LOG | 101 #ifndef BLINK_MEDIA_LOG |
| 101 #define BLINK_MEDIA_LOG DVLOG(3) | 102 #define BLINK_MEDIA_LOG DVLOG(3) |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 m_autoplaying(true), | 438 m_autoplaying(true), |
| 438 m_muted(false), | 439 m_muted(false), |
| 439 m_paused(true), | 440 m_paused(true), |
| 440 m_seeking(false), | 441 m_seeking(false), |
| 441 m_sentStalledEvent(false), | 442 m_sentStalledEvent(false), |
| 442 m_ignorePreloadNone(false), | 443 m_ignorePreloadNone(false), |
| 443 m_textTracksVisible(false), | 444 m_textTracksVisible(false), |
| 444 m_shouldPerformAutomaticTrackSelection(true), | 445 m_shouldPerformAutomaticTrackSelection(true), |
| 445 m_tracksAreReady(true), | 446 m_tracksAreReady(true), |
| 446 m_processingPreferenceChange(false), | 447 m_processingPreferenceChange(false), |
| 447 m_remoteRoutesAvailable(false), | |
| 448 m_playingRemotely(false), | 448 m_playingRemotely(false), |
| 449 m_inOverlayFullscreenVideo(false), | 449 m_inOverlayFullscreenVideo(false), |
| 450 m_audioTracks(this, AudioTrackList::create(*this)), | 450 m_audioTracks(this, AudioTrackList::create(*this)), |
| 451 m_videoTracks(this, VideoTrackList::create(*this)), | 451 m_videoTracks(this, VideoTrackList::create(*this)), |
| 452 m_textTracks(this, nullptr), | 452 m_textTracks(this, nullptr), |
| 453 m_playPromiseResolveTask(CancellableTaskFactory::create( | 453 m_playPromiseResolveTask(CancellableTaskFactory::create( |
| 454 this, | 454 this, |
| 455 &HTMLMediaElement::resolveScheduledPlayPromises)), | 455 &HTMLMediaElement::resolveScheduledPlayPromises)), |
| 456 m_playPromiseRejectTask(CancellableTaskFactory::create( | 456 m_playPromiseRejectTask(CancellableTaskFactory::create( |
| 457 this, | 457 this, |
| (...skipping 2696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3154 pauseInternal(); | 3154 pauseInternal(); |
| 3155 else | 3155 else |
| 3156 playInternal(); | 3156 playInternal(); |
| 3157 } | 3157 } |
| 3158 | 3158 |
| 3159 void HTMLMediaElement::requestSeek(double time) { | 3159 void HTMLMediaElement::requestSeek(double time) { |
| 3160 // The player is the source of this seek request. | 3160 // The player is the source of this seek request. |
| 3161 setCurrentTime(time); | 3161 setCurrentTime(time); |
| 3162 } | 3162 } |
| 3163 | 3163 |
| 3164 void HTMLMediaElement::remoteRouteAvailabilityChanged(bool routesAvailable) { | 3164 void HTMLMediaElement::remoteRouteAvailabilityChanged( |
| 3165 m_remoteRoutesAvailable = routesAvailable; | 3165 WebRemotePlaybackAvailability availability) { |
| 3166 if (remotePlaybackClient()) |
| 3167 remotePlaybackClient()->availabilityChanged(availability); |
| 3166 if (mediaControls()) | 3168 if (mediaControls()) |
| 3167 mediaControls()->refreshCastButtonVisibility(); | 3169 mediaControls()->refreshCastButtonVisibility(); |
| 3168 if (remotePlaybackClient()) | 3170 } |
| 3169 remotePlaybackClient()->availabilityChanged(routesAvailable); | 3171 |
| 3172 bool HTMLMediaElement::hasRemoteRoutes() const { |
| 3173 return remotePlaybackClient() && |
| 3174 remotePlaybackClient()->remotePlaybackAvailable(); |
| 3170 } | 3175 } |
| 3171 | 3176 |
| 3172 void HTMLMediaElement::connectedToRemoteDevice() { | 3177 void HTMLMediaElement::connectedToRemoteDevice() { |
| 3173 m_playingRemotely = true; | 3178 m_playingRemotely = true; |
| 3174 if (mediaControls()) | 3179 if (mediaControls()) |
| 3175 mediaControls()->startedCasting(); | 3180 mediaControls()->startedCasting(); |
| 3176 if (remotePlaybackClient()) | 3181 if (remotePlaybackClient()) |
| 3177 remotePlaybackClient()->stateChanged(WebRemotePlaybackState::Connecting); | 3182 remotePlaybackClient()->stateChanged(WebRemotePlaybackState::Connecting); |
| 3178 } | 3183 } |
| 3179 | 3184 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3389 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); | 3394 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
| 3390 } | 3395 } |
| 3391 | 3396 |
| 3392 stopPeriodicTimers(); | 3397 stopPeriodicTimers(); |
| 3393 m_loadTimer.stop(); | 3398 m_loadTimer.stop(); |
| 3394 | 3399 |
| 3395 m_pendingActionFlags = 0; | 3400 m_pendingActionFlags = 0; |
| 3396 m_loadState = WaitingForSource; | 3401 m_loadState = WaitingForSource; |
| 3397 | 3402 |
| 3398 // We can't cast if we don't have a media player. | 3403 // We can't cast if we don't have a media player. |
| 3399 m_remoteRoutesAvailable = false; | |
| 3400 m_playingRemotely = false; | 3404 m_playingRemotely = false; |
| 3401 if (mediaControls()) | 3405 remoteRouteAvailabilityChanged(WebRemotePlaybackAvailability::Unknown); |
| 3402 mediaControls()->refreshCastButtonVisibilityWithoutUpdate(); | |
| 3403 | 3406 |
| 3404 if (layoutObject()) | 3407 if (layoutObject()) |
| 3405 layoutObject()->setShouldDoFullPaintInvalidation(); | 3408 layoutObject()->setShouldDoFullPaintInvalidation(); |
| 3406 } | 3409 } |
| 3407 | 3410 |
| 3408 void HTMLMediaElement::contextDestroyed() { | 3411 void HTMLMediaElement::contextDestroyed() { |
| 3409 BLINK_MEDIA_LOG << "contextDestroyed(" << (void*)this << ")"; | 3412 BLINK_MEDIA_LOG << "contextDestroyed(" << (void*)this << ")"; |
| 3410 | 3413 |
| 3411 // Close the async event queue so that no events are enqueued. | 3414 // Close the async event queue so that no events are enqueued. |
| 3412 cancelPendingEventsAndCallbacks(); | 3415 cancelPendingEventsAndCallbacks(); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3750 // TODO(srirama.m): Merge it to resetMediaElement if possible and remove it. | 3753 // TODO(srirama.m): Merge it to resetMediaElement if possible and remove it. |
| 3751 void HTMLMediaElement::resetMediaPlayerAndMediaSource() { | 3754 void HTMLMediaElement::resetMediaPlayerAndMediaSource() { |
| 3752 closeMediaSource(); | 3755 closeMediaSource(); |
| 3753 | 3756 |
| 3754 { | 3757 { |
| 3755 AudioSourceProviderClientLockScope scope(*this); | 3758 AudioSourceProviderClientLockScope scope(*this); |
| 3756 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); | 3759 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
| 3757 } | 3760 } |
| 3758 | 3761 |
| 3759 // We haven't yet found out if any remote routes are available. | 3762 // We haven't yet found out if any remote routes are available. |
| 3760 m_remoteRoutesAvailable = false; | |
| 3761 m_playingRemotely = false; | 3763 m_playingRemotely = false; |
| 3764 remoteRouteAvailabilityChanged(WebRemotePlaybackAvailability::Unknown); |
| 3762 | 3765 |
| 3763 if (m_audioSourceNode) | 3766 if (m_audioSourceNode) |
| 3764 getAudioSourceProvider().setClient(m_audioSourceNode); | 3767 getAudioSourceProvider().setClient(m_audioSourceNode); |
| 3765 } | 3768 } |
| 3766 | 3769 |
| 3767 void HTMLMediaElement::setAudioSourceNode( | 3770 void HTMLMediaElement::setAudioSourceNode( |
| 3768 AudioSourceProviderClient* sourceNode) { | 3771 AudioSourceProviderClient* sourceNode) { |
| 3769 DCHECK(isMainThread()); | 3772 DCHECK(isMainThread()); |
| 3770 m_audioSourceNode = sourceNode; | 3773 m_audioSourceNode = sourceNode; |
| 3771 | 3774 |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4179 | 4182 |
| 4180 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() | 4183 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() |
| 4181 const { | 4184 const { |
| 4182 IntRect result; | 4185 IntRect result; |
| 4183 if (LayoutObject* object = m_element->layoutObject()) | 4186 if (LayoutObject* object = m_element->layoutObject()) |
| 4184 result = object->absoluteBoundingBoxRect(); | 4187 result = object->absoluteBoundingBoxRect(); |
| 4185 return result; | 4188 return result; |
| 4186 } | 4189 } |
| 4187 | 4190 |
| 4188 } // namespace blink | 4191 } // namespace blink |
| OLD | NEW |