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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2480003002: [RemotePlayback] Keep track of source compatibility and reject prompt() correspondingly (Closed)
Patch Set: Fixed the java enum comment Created 4 years, 1 month 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 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
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
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 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after
3161 pauseInternal(); 3161 pauseInternal();
3162 else 3162 else
3163 playInternal(); 3163 playInternal();
3164 } 3164 }
3165 3165
3166 void HTMLMediaElement::requestSeek(double time) { 3166 void HTMLMediaElement::requestSeek(double time) {
3167 // The player is the source of this seek request. 3167 // The player is the source of this seek request.
3168 setCurrentTime(time); 3168 setCurrentTime(time);
3169 } 3169 }
3170 3170
3171 void HTMLMediaElement::remoteRouteAvailabilityChanged(bool routesAvailable) { 3171 void HTMLMediaElement::remoteRouteAvailabilityChanged(
3172 m_remoteRoutesAvailable = routesAvailable; 3172 WebRemotePlaybackAvailability availability) {
3173 if (remotePlaybackClient())
3174 remotePlaybackClient()->availabilityChanged(availability);
3173 if (mediaControls()) 3175 if (mediaControls())
3174 mediaControls()->refreshCastButtonVisibility(); 3176 mediaControls()->refreshCastButtonVisibility();
3175 if (remotePlaybackClient()) 3177 }
3176 remotePlaybackClient()->availabilityChanged(routesAvailable); 3178
3179 bool HTMLMediaElement::hasRemoteRoutes() const {
3180 return remotePlaybackClient() &&
3181 remotePlaybackClient()->remotePlaybackAvailable();
3177 } 3182 }
3178 3183
3179 void HTMLMediaElement::connectedToRemoteDevice() { 3184 void HTMLMediaElement::connectedToRemoteDevice() {
3180 m_playingRemotely = true; 3185 m_playingRemotely = true;
3181 if (mediaControls()) 3186 if (mediaControls())
3182 mediaControls()->startedCasting(); 3187 mediaControls()->startedCasting();
3183 if (remotePlaybackClient()) 3188 if (remotePlaybackClient())
3184 remotePlaybackClient()->stateChanged(WebRemotePlaybackState::Connecting); 3189 remotePlaybackClient()->stateChanged(WebRemotePlaybackState::Connecting);
3185 } 3190 }
3186 3191
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
3396 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); 3401 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking();
3397 } 3402 }
3398 3403
3399 stopPeriodicTimers(); 3404 stopPeriodicTimers();
3400 m_loadTimer.stop(); 3405 m_loadTimer.stop();
3401 3406
3402 m_pendingActionFlags = 0; 3407 m_pendingActionFlags = 0;
3403 m_loadState = WaitingForSource; 3408 m_loadState = WaitingForSource;
3404 3409
3405 // We can't cast if we don't have a media player. 3410 // We can't cast if we don't have a media player.
3406 m_remoteRoutesAvailable = false;
3407 m_playingRemotely = false; 3411 m_playingRemotely = false;
3408 if (mediaControls()) 3412 remoteRouteAvailabilityChanged(WebRemotePlaybackAvailability::Unknown);
3409 mediaControls()->refreshCastButtonVisibilityWithoutUpdate();
3410 3413
3411 if (layoutObject()) 3414 if (layoutObject())
3412 layoutObject()->setShouldDoFullPaintInvalidation(); 3415 layoutObject()->setShouldDoFullPaintInvalidation();
3413 } 3416 }
3414 3417
3415 void HTMLMediaElement::contextDestroyed() { 3418 void HTMLMediaElement::contextDestroyed() {
3416 BLINK_MEDIA_LOG << "contextDestroyed(" << (void*)this << ")"; 3419 BLINK_MEDIA_LOG << "contextDestroyed(" << (void*)this << ")";
3417 3420
3418 // Close the async event queue so that no events are enqueued. 3421 // Close the async event queue so that no events are enqueued.
3419 cancelPendingEventsAndCallbacks(); 3422 cancelPendingEventsAndCallbacks();
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
3757 // TODO(srirama.m): Merge it to resetMediaElement if possible and remove it. 3760 // TODO(srirama.m): Merge it to resetMediaElement if possible and remove it.
3758 void HTMLMediaElement::resetMediaPlayerAndMediaSource() { 3761 void HTMLMediaElement::resetMediaPlayerAndMediaSource() {
3759 closeMediaSource(); 3762 closeMediaSource();
3760 3763
3761 { 3764 {
3762 AudioSourceProviderClientLockScope scope(*this); 3765 AudioSourceProviderClientLockScope scope(*this);
3763 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); 3766 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking();
3764 } 3767 }
3765 3768
3766 // We haven't yet found out if any remote routes are available. 3769 // We haven't yet found out if any remote routes are available.
3767 m_remoteRoutesAvailable = false;
3768 m_playingRemotely = false; 3770 m_playingRemotely = false;
3771 remoteRouteAvailabilityChanged(WebRemotePlaybackAvailability::Unknown);
3769 3772
3770 if (m_audioSourceNode) 3773 if (m_audioSourceNode)
3771 getAudioSourceProvider().setClient(m_audioSourceNode); 3774 getAudioSourceProvider().setClient(m_audioSourceNode);
3772 } 3775 }
3773 3776
3774 void HTMLMediaElement::setAudioSourceNode( 3777 void HTMLMediaElement::setAudioSourceNode(
3775 AudioSourceProviderClient* sourceNode) { 3778 AudioSourceProviderClient* sourceNode) {
3776 DCHECK(isMainThread()); 3779 DCHECK(isMainThread());
3777 m_audioSourceNode = sourceNode; 3780 m_audioSourceNode = sourceNode;
3778 3781
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
4189 4192
4190 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() 4193 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect()
4191 const { 4194 const {
4192 IntRect result; 4195 IntRect result;
4193 if (LayoutObject* object = m_element->layoutObject()) 4196 if (LayoutObject* object = m_element->layoutObject())
4194 result = object->absoluteBoundingBoxRect(); 4197 result = object->absoluteBoundingBoxRect();
4195 return result; 4198 return result;
4196 } 4199 }
4197 4200
4198 } // namespace blink 4201 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698