| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 SetReadyState(WebMediaPlayer::ReadyStateHaveNothing); | 284 SetReadyState(WebMediaPlayer::ReadyStateHaveNothing); |
| 285 media_log_->AddEvent(media_log_->CreateLoadEvent(url.string().utf8())); | 285 media_log_->AddEvent(media_log_->CreateLoadEvent(url.string().utf8())); |
| 286 | 286 |
| 287 // Media source pipelines can start immediately. | 287 // Media source pipelines can start immediately. |
| 288 if (load_type == LoadTypeMediaSource) { | 288 if (load_type == LoadTypeMediaSource) { |
| 289 supports_save_ = false; | 289 supports_save_ = false; |
| 290 StartPipeline(); | 290 StartPipeline(); |
| 291 return; | 291 return; |
| 292 } | 292 } |
| 293 | 293 |
| 294 // TODO(hubbe): This experiment is temporary and should be removed once |
| 295 // we have enough data to support the primacy of the new media cache. |
| 296 // See http://crbug.com/514719 for details. |
| 294 // Otherwise it's a regular request which requires resolving the URL first. | 297 // Otherwise it's a regular request which requires resolving the URL first. |
| 295 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 298 if (base::FeatureList::IsEnabled(kUseNewMediaCache)) { |
| 296 switches::kUseNewMediaCache)) { | |
| 297 // Remove this when MultiBufferDataSource becomes default. | 299 // Remove this when MultiBufferDataSource becomes default. |
| 298 LOG(WARNING) << "Using MultibufferDataSource"; | 300 LOG(WARNING) << "Using MultibufferDataSource"; |
| 299 data_source_.reset(new MultibufferDataSource( | 301 data_source_.reset(new MultibufferDataSource( |
| 300 url, static_cast<UrlData::CORSMode>(cors_mode), main_task_runner_, | 302 url, static_cast<UrlData::CORSMode>(cors_mode), main_task_runner_, |
| 301 url_index_, frame_, media_log_.get(), &buffered_data_source_host_, | 303 url_index_, frame_, media_log_.get(), &buffered_data_source_host_, |
| 302 base::Bind(&WebMediaPlayerImpl::NotifyDownloading, AsWeakPtr()))); | 304 base::Bind(&WebMediaPlayerImpl::NotifyDownloading, AsWeakPtr()))); |
| 303 } else { | 305 } else { |
| 304 data_source_.reset(new BufferedDataSource( | 306 data_source_.reset(new BufferedDataSource( |
| 305 url, static_cast<BufferedResourceLoader::CORSMode>(cors_mode), | 307 url, static_cast<BufferedResourceLoader::CORSMode>(cors_mode), |
| 306 main_task_runner_, frame_, media_log_.get(), | 308 main_task_runner_, frame_, media_log_.get(), |
| (...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 << ", Video: " << stats.video_memory_usage << ", DataSource: " | 1543 << ", Video: " << stats.video_memory_usage << ", DataSource: " |
| 1542 << (data_source_ ? data_source_->GetMemoryUsage() : 0) | 1544 << (data_source_ ? data_source_->GetMemoryUsage() : 0) |
| 1543 << ", Demuxer: " << demuxer_memory_usage; | 1545 << ", Demuxer: " << demuxer_memory_usage; |
| 1544 | 1546 |
| 1545 const int64_t delta = current_memory_usage - last_reported_memory_usage_; | 1547 const int64_t delta = current_memory_usage - last_reported_memory_usage_; |
| 1546 last_reported_memory_usage_ = current_memory_usage; | 1548 last_reported_memory_usage_ = current_memory_usage; |
| 1547 adjust_allocated_memory_cb_.Run(delta); | 1549 adjust_allocated_memory_cb_.Run(delta); |
| 1548 } | 1550 } |
| 1549 | 1551 |
| 1550 } // namespace media | 1552 } // namespace media |
| OLD | NEW |