| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 | 200 |
| 201 // TODO(xhwang): When we use an external Renderer, many methods won't work, | 201 // TODO(xhwang): When we use an external Renderer, many methods won't work, |
| 202 // e.g. GetCurrentFrameFromCompositor(). See http://crbug.com/434861 | 202 // e.g. GetCurrentFrameFromCompositor(). See http://crbug.com/434861 |
| 203 | 203 |
| 204 // Use the null sink if no sink was provided. | 204 // Use the null sink if no sink was provided. |
| 205 audio_source_provider_ = new WebAudioSourceProviderImpl( | 205 audio_source_provider_ = new WebAudioSourceProviderImpl( |
| 206 params.audio_renderer_sink().get() | 206 params.audio_renderer_sink().get() |
| 207 ? params.audio_renderer_sink() | 207 ? params.audio_renderer_sink() |
| 208 : new NullAudioSink(media_task_runner_)); | 208 : new NullAudioSink(media_task_runner_)); |
| 209 #if defined(OS_ANDROID) |
| 210 audio_source_provider_->enable_audio_focus(); |
| 211 #endif |
| 209 } | 212 } |
| 210 | 213 |
| 211 WebMediaPlayerImpl::~WebMediaPlayerImpl() { | 214 WebMediaPlayerImpl::~WebMediaPlayerImpl() { |
| 212 client_->setWebLayer(NULL); | 215 client_->setWebLayer(NULL); |
| 213 | 216 |
| 214 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 217 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 215 | 218 |
| 216 if (delegate_) | 219 if (delegate_) |
| 217 delegate_->PlayerGone(this); | 220 delegate_->PlayerGone(this); |
| 218 | 221 |
| (...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1388 << ", Video: " << stats.video_memory_usage << ", DataSource: " | 1391 << ", Video: " << stats.video_memory_usage << ", DataSource: " |
| 1389 << (data_source_ ? data_source_->GetMemoryUsage() : 0) | 1392 << (data_source_ ? data_source_->GetMemoryUsage() : 0) |
| 1390 << ", Demuxer: " << demuxer_memory_usage; | 1393 << ", Demuxer: " << demuxer_memory_usage; |
| 1391 | 1394 |
| 1392 const int64_t delta = current_memory_usage - last_reported_memory_usage_; | 1395 const int64_t delta = current_memory_usage - last_reported_memory_usage_; |
| 1393 last_reported_memory_usage_ = current_memory_usage; | 1396 last_reported_memory_usage_ = current_memory_usage; |
| 1394 adjust_allocated_memory_cb_.Run(delta); | 1397 adjust_allocated_memory_cb_.Run(delta); |
| 1395 } | 1398 } |
| 1396 | 1399 |
| 1397 } // namespace media | 1400 } // namespace media |
| OLD | NEW |