| OLD | NEW |
| 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 "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 ScheduleRestart(); | 275 ScheduleRestart(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 void WebMediaPlayerImpl::DoLoad(LoadType load_type, | 278 void WebMediaPlayerImpl::DoLoad(LoadType load_type, |
| 279 const blink::WebURL& url, | 279 const blink::WebURL& url, |
| 280 CORSMode cors_mode) { | 280 CORSMode cors_mode) { |
| 281 DVLOG(1) << __FUNCTION__; | 281 DVLOG(1) << __FUNCTION__; |
| 282 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 282 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 283 | 283 |
| 284 GURL gurl(url); | 284 GURL gurl(url); |
| 285 ReportMetrics(load_type, gurl, frame_->document().securityOrigin()); | 285 ReportMetrics(load_type, gurl, frame_->document().getSecurityOrigin()); |
| 286 | 286 |
| 287 // Set subresource URL for crash reporting. | 287 // Set subresource URL for crash reporting. |
| 288 base::debug::SetCrashKeyValue("subresource_url", gurl.spec()); | 288 base::debug::SetCrashKeyValue("subresource_url", gurl.spec()); |
| 289 | 289 |
| 290 load_type_ = load_type; | 290 load_type_ = load_type; |
| 291 | 291 |
| 292 SetNetworkState(WebMediaPlayer::NetworkStateLoading); | 292 SetNetworkState(WebMediaPlayer::NetworkStateLoading); |
| 293 SetReadyState(WebMediaPlayer::ReadyStateHaveNothing); | 293 SetReadyState(WebMediaPlayer::ReadyStateHaveNothing); |
| 294 media_log_->AddEvent(media_log_->CreateLoadEvent(url.string().utf8())); | 294 media_log_->AddEvent(media_log_->CreateLoadEvent(url.string().utf8())); |
| 295 | 295 |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 if (state == WebMediaPlayer::ReadyStateHaveEnoughData && data_source_ && | 1263 if (state == WebMediaPlayer::ReadyStateHaveEnoughData && data_source_ && |
| 1264 data_source_->assume_fully_buffered() && | 1264 data_source_->assume_fully_buffered() && |
| 1265 network_state_ == WebMediaPlayer::NetworkStateLoading) | 1265 network_state_ == WebMediaPlayer::NetworkStateLoading) |
| 1266 SetNetworkState(WebMediaPlayer::NetworkStateLoaded); | 1266 SetNetworkState(WebMediaPlayer::NetworkStateLoaded); |
| 1267 | 1267 |
| 1268 ready_state_ = state; | 1268 ready_state_ = state; |
| 1269 // Always notify to ensure client has the latest value. | 1269 // Always notify to ensure client has the latest value. |
| 1270 client_->readyStateChanged(); | 1270 client_->readyStateChanged(); |
| 1271 } | 1271 } |
| 1272 | 1272 |
| 1273 blink::WebAudioSourceProvider* WebMediaPlayerImpl::audioSourceProvider() { | 1273 blink::WebAudioSourceProvider* WebMediaPlayerImpl::getAudioSourceProvider() { |
| 1274 return audio_source_provider_.get(); | 1274 return audio_source_provider_.get(); |
| 1275 } | 1275 } |
| 1276 | 1276 |
| 1277 double WebMediaPlayerImpl::GetPipelineDuration() const { | 1277 double WebMediaPlayerImpl::GetPipelineDuration() const { |
| 1278 base::TimeDelta duration = pipeline_.GetMediaDuration(); | 1278 base::TimeDelta duration = pipeline_.GetMediaDuration(); |
| 1279 | 1279 |
| 1280 // Return positive infinity if the resource is unbounded. | 1280 // Return positive infinity if the resource is unbounded. |
| 1281 // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-
media-duration | 1281 // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#dom-
media-duration |
| 1282 if (duration == kInfiniteDuration()) | 1282 if (duration == kInfiniteDuration()) |
| 1283 return std::numeric_limits<double>::infinity(); | 1283 return std::numeric_limits<double>::infinity(); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 << ", Video: " << stats.video_memory_usage << ", DataSource: " | 1428 << ", Video: " << stats.video_memory_usage << ", DataSource: " |
| 1429 << (data_source_ ? data_source_->GetMemoryUsage() : 0) | 1429 << (data_source_ ? data_source_->GetMemoryUsage() : 0) |
| 1430 << ", Demuxer: " << demuxer_memory_usage; | 1430 << ", Demuxer: " << demuxer_memory_usage; |
| 1431 | 1431 |
| 1432 const int64_t delta = current_memory_usage - last_reported_memory_usage_; | 1432 const int64_t delta = current_memory_usage - last_reported_memory_usage_; |
| 1433 last_reported_memory_usage_ = current_memory_usage; | 1433 last_reported_memory_usage_ = current_memory_usage; |
| 1434 adjust_allocated_memory_cb_.Run(delta); | 1434 adjust_allocated_memory_cb_.Run(delta); |
| 1435 } | 1435 } |
| 1436 | 1436 |
| 1437 } // namespace media | 1437 } // namespace media |
| OLD | NEW |