| 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 #include <v8.h> | 100 #include <v8.h> |
| 100 | 101 |
| 101 #ifndef BLINK_MEDIA_LOG | 102 #ifndef BLINK_MEDIA_LOG |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 m_autoplaying(true), | 439 m_autoplaying(true), |
| 439 m_muted(false), | 440 m_muted(false), |
| 440 m_paused(true), | 441 m_paused(true), |
| 441 m_seeking(false), | 442 m_seeking(false), |
| 442 m_sentStalledEvent(false), | 443 m_sentStalledEvent(false), |
| 443 m_ignorePreloadNone(false), | 444 m_ignorePreloadNone(false), |
| 444 m_textTracksVisible(false), | 445 m_textTracksVisible(false), |
| 445 m_shouldPerformAutomaticTrackSelection(true), | 446 m_shouldPerformAutomaticTrackSelection(true), |
| 446 m_tracksAreReady(true), | 447 m_tracksAreReady(true), |
| 447 m_processingPreferenceChange(false), | 448 m_processingPreferenceChange(false), |
| 448 m_remoteRoutesAvailable(false), | |
| 449 m_playingRemotely(false), | 449 m_playingRemotely(false), |
| 450 m_inOverlayFullscreenVideo(false), | 450 m_inOverlayFullscreenVideo(false), |
| 451 m_audioTracks(this, AudioTrackList::create(*this)), | 451 m_audioTracks(this, AudioTrackList::create(*this)), |
| 452 m_videoTracks(this, VideoTrackList::create(*this)), | 452 m_videoTracks(this, VideoTrackList::create(*this)), |
| 453 m_textTracks(this, nullptr), | 453 m_textTracks(this, nullptr), |
| 454 m_playPromiseResolveTask(CancellableTaskFactory::create( | 454 m_playPromiseResolveTask(CancellableTaskFactory::create( |
| 455 this, | 455 this, |
| 456 &HTMLMediaElement::resolveScheduledPlayPromises)), | 456 &HTMLMediaElement::resolveScheduledPlayPromises)), |
| 457 m_playPromiseRejectTask(CancellableTaskFactory::create( | 457 m_playPromiseRejectTask(CancellableTaskFactory::create( |
| 458 this, | 458 this, |
| (...skipping 2696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3155 pauseInternal(); | 3155 pauseInternal(); |
| 3156 else | 3156 else |
| 3157 playInternal(); | 3157 playInternal(); |
| 3158 } | 3158 } |
| 3159 | 3159 |
| 3160 void HTMLMediaElement::requestSeek(double time) { | 3160 void HTMLMediaElement::requestSeek(double time) { |
| 3161 // The player is the source of this seek request. | 3161 // The player is the source of this seek request. |
| 3162 setCurrentTime(time); | 3162 setCurrentTime(time); |
| 3163 } | 3163 } |
| 3164 | 3164 |
| 3165 void HTMLMediaElement::remoteRouteAvailabilityChanged(bool routesAvailable) { | 3165 void HTMLMediaElement::remoteRouteAvailabilityChanged( |
| 3166 m_remoteRoutesAvailable = routesAvailable; | 3166 WebRemotePlaybackAvailability availability) { |
| 3167 if (remotePlaybackClient()) |
| 3168 remotePlaybackClient()->availabilityChanged(availability); |
| 3167 if (mediaControls()) | 3169 if (mediaControls()) |
| 3168 mediaControls()->refreshCastButtonVisibility(); | 3170 mediaControls()->refreshCastButtonVisibility(); |
| 3169 if (remotePlaybackClient()) | 3171 } |
| 3170 remotePlaybackClient()->availabilityChanged(routesAvailable); | 3172 |
| 3173 bool HTMLMediaElement::hasRemoteRoutes() const { |
| 3174 return remotePlaybackClient() && |
| 3175 remotePlaybackClient()->remotePlaybackAvailable(); |
| 3171 } | 3176 } |
| 3172 | 3177 |
| 3173 void HTMLMediaElement::connectedToRemoteDevice() { | 3178 void HTMLMediaElement::connectedToRemoteDevice() { |
| 3174 m_playingRemotely = true; | 3179 m_playingRemotely = true; |
| 3175 if (mediaControls()) | 3180 if (mediaControls()) |
| 3176 mediaControls()->startedCasting(); | 3181 mediaControls()->startedCasting(); |
| 3177 if (remotePlaybackClient()) | 3182 if (remotePlaybackClient()) |
| 3178 remotePlaybackClient()->stateChanged(WebRemotePlaybackState::Connecting); | 3183 remotePlaybackClient()->stateChanged(WebRemotePlaybackState::Connecting); |
| 3179 } | 3184 } |
| 3180 | 3185 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3390 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); | 3395 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
| 3391 } | 3396 } |
| 3392 | 3397 |
| 3393 stopPeriodicTimers(); | 3398 stopPeriodicTimers(); |
| 3394 m_loadTimer.stop(); | 3399 m_loadTimer.stop(); |
| 3395 | 3400 |
| 3396 m_pendingActionFlags = 0; | 3401 m_pendingActionFlags = 0; |
| 3397 m_loadState = WaitingForSource; | 3402 m_loadState = WaitingForSource; |
| 3398 | 3403 |
| 3399 // We can't cast if we don't have a media player. | 3404 // We can't cast if we don't have a media player. |
| 3400 m_remoteRoutesAvailable = false; | |
| 3401 m_playingRemotely = false; | 3405 m_playingRemotely = false; |
| 3402 if (mediaControls()) | 3406 remoteRouteAvailabilityChanged(WebRemotePlaybackAvailability::Unknown); |
| 3403 mediaControls()->refreshCastButtonVisibilityWithoutUpdate(); | |
| 3404 | 3407 |
| 3405 if (layoutObject()) | 3408 if (layoutObject()) |
| 3406 layoutObject()->setShouldDoFullPaintInvalidation(); | 3409 layoutObject()->setShouldDoFullPaintInvalidation(); |
| 3407 } | 3410 } |
| 3408 | 3411 |
| 3409 void HTMLMediaElement::contextDestroyed() { | 3412 void HTMLMediaElement::contextDestroyed() { |
| 3410 BLINK_MEDIA_LOG << "contextDestroyed(" << (void*)this << ")"; | 3413 BLINK_MEDIA_LOG << "contextDestroyed(" << (void*)this << ")"; |
| 3411 | 3414 |
| 3412 // Close the async event queue so that no events are enqueued. | 3415 // Close the async event queue so that no events are enqueued. |
| 3413 cancelPendingEventsAndCallbacks(); | 3416 cancelPendingEventsAndCallbacks(); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3751 // TODO(srirama.m): Merge it to resetMediaElement if possible and remove it. | 3754 // TODO(srirama.m): Merge it to resetMediaElement if possible and remove it. |
| 3752 void HTMLMediaElement::resetMediaPlayerAndMediaSource() { | 3755 void HTMLMediaElement::resetMediaPlayerAndMediaSource() { |
| 3753 closeMediaSource(); | 3756 closeMediaSource(); |
| 3754 | 3757 |
| 3755 { | 3758 { |
| 3756 AudioSourceProviderClientLockScope scope(*this); | 3759 AudioSourceProviderClientLockScope scope(*this); |
| 3757 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); | 3760 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
| 3758 } | 3761 } |
| 3759 | 3762 |
| 3760 // We haven't yet found out if any remote routes are available. | 3763 // We haven't yet found out if any remote routes are available. |
| 3761 m_remoteRoutesAvailable = false; | |
| 3762 m_playingRemotely = false; | 3764 m_playingRemotely = false; |
| 3765 remoteRouteAvailabilityChanged(WebRemotePlaybackAvailability::Unknown); |
| 3763 | 3766 |
| 3764 if (m_audioSourceNode) | 3767 if (m_audioSourceNode) |
| 3765 getAudioSourceProvider().setClient(m_audioSourceNode); | 3768 getAudioSourceProvider().setClient(m_audioSourceNode); |
| 3766 } | 3769 } |
| 3767 | 3770 |
| 3768 void HTMLMediaElement::setAudioSourceNode( | 3771 void HTMLMediaElement::setAudioSourceNode( |
| 3769 AudioSourceProviderClient* sourceNode) { | 3772 AudioSourceProviderClient* sourceNode) { |
| 3770 DCHECK(isMainThread()); | 3773 DCHECK(isMainThread()); |
| 3771 m_audioSourceNode = sourceNode; | 3774 m_audioSourceNode = sourceNode; |
| 3772 | 3775 |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4180 | 4183 |
| 4181 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() | 4184 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() |
| 4182 const { | 4185 const { |
| 4183 IntRect result; | 4186 IntRect result; |
| 4184 if (LayoutObject* object = m_element->layoutObject()) | 4187 if (LayoutObject* object = m_element->layoutObject()) |
| 4185 result = object->absoluteBoundingBoxRect(); | 4188 result = object->absoluteBoundingBoxRect(); |
| 4186 return result; | 4189 return result; |
| 4187 } | 4190 } |
| 4188 | 4191 |
| 4189 } // namespace blink | 4192 } // namespace blink |
| OLD | NEW |