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

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 2382023005: Fix nits leftover from WMPA MSE deletion. (Closed)
Patch Set: Created 4 years, 2 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/android/webmediaplayer_android.h" 5 #include "content/renderer/media/android/webmediaplayer_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 int frame_id, 137 int frame_id,
138 bool enable_texture_copy, 138 bool enable_texture_copy,
139 const media::WebMediaPlayerParams& params) 139 const media::WebMediaPlayerParams& params)
140 : frame_(frame), 140 : frame_(frame),
141 client_(client), 141 client_(client),
142 delegate_(delegate), 142 delegate_(delegate),
143 delegate_id_(0), 143 delegate_id_(0),
144 defer_load_cb_(params.defer_load_cb()), 144 defer_load_cb_(params.defer_load_cb()),
145 buffered_(static_cast<size_t>(1)), 145 buffered_(static_cast<size_t>(1)),
146 media_task_runner_(params.media_task_runner()), 146 media_task_runner_(params.media_task_runner()),
147 ignore_metadata_duration_change_(false),
148 pending_seek_(false), 147 pending_seek_(false),
149 seeking_(false), 148 seeking_(false),
150 did_loading_progress_(false), 149 did_loading_progress_(false),
151 player_manager_(player_manager), 150 player_manager_(player_manager),
152 network_state_(WebMediaPlayer::NetworkStateEmpty), 151 network_state_(WebMediaPlayer::NetworkStateEmpty),
153 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), 152 ready_state_(WebMediaPlayer::ReadyStateHaveNothing),
154 texture_id_(0), 153 texture_id_(0),
155 stream_id_(0), 154 stream_id_(0),
156 is_player_initialized_(false), 155 is_player_initialized_(false),
157 is_playing_(false), 156 is_playing_(false),
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 if (is_local_resource_) 681 if (is_local_resource_)
683 UpdateNetworkState(WebMediaPlayer::NetworkStateLoaded); 682 UpdateNetworkState(WebMediaPlayer::NetworkStateLoaded);
684 683
685 // For HLS streams, the reported duration may be zero for infinite streams. 684 // For HLS streams, the reported duration may be zero for infinite streams.
686 // See http://crbug.com/501213. 685 // See http://crbug.com/501213.
687 if (duration.is_zero() && IsHLSStream()) 686 if (duration.is_zero() && IsHLSStream())
688 duration = media::kInfiniteDuration; 687 duration = media::kInfiniteDuration;
689 688
690 // Update duration, if necessary, prior to ready state updates that may 689 // Update duration, if necessary, prior to ready state updates that may
691 // cause duration() query. 690 // cause duration() query.
692 if (!ignore_metadata_duration_change_ && duration_ != duration) { 691 if (duration_ != duration) {
693 duration_ = duration; 692 duration_ = duration;
694 if (is_local_resource_) 693 if (is_local_resource_)
695 buffered_[0].end = duration_.InSecondsF(); 694 buffered_[0].end = duration_.InSecondsF();
696 // Client readyState transition from HAVE_NOTHING to HAVE_METADATA 695 // Client readyState transition from HAVE_NOTHING to HAVE_METADATA
697 // already triggers a durationchanged event. If this is a different 696 // already triggers a durationchanged event. If this is a different
698 // transition, remember to signal durationchanged. 697 // transition, remember to signal durationchanged.
699 if (ready_state_ > WebMediaPlayer::ReadyStateHaveNothing) 698 if (ready_state_ > WebMediaPlayer::ReadyStateHaveNothing)
700 need_to_signal_duration_changed = true; 699 need_to_signal_duration_changed = true;
701 } 700 }
702 701
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 } else { 1223 } else {
1225 // Even if OnPlaybackComplete() has not been called yet, Blink may have 1224 // Even if OnPlaybackComplete() has not been called yet, Blink may have
1226 // already fired the ended event based on current time relative to 1225 // already fired the ended event based on current time relative to
1227 // duration -- so we need to check both possibilities here. 1226 // duration -- so we need to check both possibilities here.
1228 delegate_->DidPause(delegate_id_, 1227 delegate_->DidPause(delegate_id_,
1229 playback_completed_ || currentTime() >= duration()); 1228 playback_completed_ || currentTime() >= duration());
1230 } 1229 }
1231 } 1230 }
1232 } 1231 }
1233 1232
1234 void WebMediaPlayerAndroid::setContentDecryptionModule(
1235 blink::WebContentDecryptionModule* cdm,
1236 blink::WebContentDecryptionModuleResult result) {
1237 DCHECK(main_thread_checker_.CalledOnValidThread());
1238
1239 result.completeWithError(
1240 blink::WebContentDecryptionModuleExceptionInvalidStateError, 0,
1241 "EME is not supported for this playback.");
1242 }
1243
1244 void WebMediaPlayerAndroid::OnHidden() { 1233 void WebMediaPlayerAndroid::OnHidden() {
1245 // Pause audible video preserving its session. 1234 // Pause audible video preserving its session.
1246 if (hasVideo() && IsBackgroundVideoCandidate() && !paused()) { 1235 if (hasVideo() && IsBackgroundVideoCandidate() && !paused()) {
1247 Pause(false); 1236 Pause(false);
1248 is_play_pending_ = true; 1237 is_play_pending_ = true;
1249 return; 1238 return;
1250 } 1239 }
1251 1240
1252 OnSuspendRequested(false); 1241 OnSuspendRequested(false);
1253 } 1242 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1336 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1348 switches::kDisableMediaSuspend)) { 1337 switches::kDisableMediaSuspend)) {
1349 return false; 1338 return false;
1350 } 1339 }
1351 1340
1352 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) && 1341 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) &&
1353 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden(); 1342 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden();
1354 } 1343 }
1355 1344
1356 } // namespace content 1345 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | media/base/android/media_codec_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698