| 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 "content/renderer/media/webmediaplayer_ms.h" | 5 #include "content/renderer/media/webmediaplayer_ms.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 13 #include "cc/blink/context_provider_web_context.h" | 14 #include "cc/blink/context_provider_web_context.h" |
| 14 #include "cc/blink/web_layer_impl.h" | 15 #include "cc/blink/web_layer_impl.h" |
| 15 #include "cc/layers/video_frame_provider_client_impl.h" | 16 #include "cc/layers/video_frame_provider_client_impl.h" |
| 16 #include "cc/layers/video_layer.h" | 17 #include "cc/layers/video_layer.h" |
| 17 #include "content/public/renderer/media_stream_audio_renderer.h" | 18 #include "content/public/renderer/media_stream_audio_renderer.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 void WebMediaPlayerMS::setSinkId(const blink::WebString& device_id, | 253 void WebMediaPlayerMS::setSinkId(const blink::WebString& device_id, |
| 253 media::WebSetSinkIdCB* web_callback) { | 254 media::WebSetSinkIdCB* web_callback) { |
| 254 DCHECK(thread_checker_.CalledOnValidThread()); | 255 DCHECK(thread_checker_.CalledOnValidThread()); |
| 255 DVLOG(1) << __FUNCTION__; | 256 DVLOG(1) << __FUNCTION__; |
| 256 media::SwitchOutputDeviceCB callback = | 257 media::SwitchOutputDeviceCB callback = |
| 257 media::ConvertToSwitchOutputDeviceCB(web_callback); | 258 media::ConvertToSwitchOutputDeviceCB(web_callback); |
| 258 if (audio_renderer_.get()) { | 259 if (audio_renderer_.get()) { |
| 259 media::OutputDevice* output_device = audio_renderer_->GetOutputDevice(); | 260 media::OutputDevice* output_device = audio_renderer_->GetOutputDevice(); |
| 260 if (output_device) { | 261 if (output_device) { |
| 261 const std::string device_id_str(device_id.utf8()); | 262 const std::string device_id_str(device_id.utf8()); |
| 262 const GURL security_origin(frame_->securityOrigin().toString().utf8()); | 263 const url::Origin security_origin( |
| 264 GURL(frame_->securityOrigin().toString().utf8())); |
| 263 output_device->SwitchOutputDevice(device_id_str, security_origin, | 265 output_device->SwitchOutputDevice(device_id_str, security_origin, |
| 264 callback); | 266 callback); |
| 265 return; | 267 return; |
| 266 } | 268 } |
| 267 } | 269 } |
| 268 callback.Run(media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_NOT_SUPPORTED); | 270 callback.Run(media::SWITCH_OUTPUT_DEVICE_RESULT_ERROR_INTERNAL); |
| 269 } | 271 } |
| 270 | 272 |
| 271 void WebMediaPlayerMS::setPreload(WebMediaPlayer::Preload preload) { | 273 void WebMediaPlayerMS::setPreload(WebMediaPlayer::Preload preload) { |
| 272 DCHECK(thread_checker_.CalledOnValidThread()); | 274 DCHECK(thread_checker_.CalledOnValidThread()); |
| 273 } | 275 } |
| 274 | 276 |
| 275 bool WebMediaPlayerMS::hasVideo() const { | 277 bool WebMediaPlayerMS::hasVideo() const { |
| 276 DCHECK(thread_checker_.CalledOnValidThread()); | 278 DCHECK(thread_checker_.CalledOnValidThread()); |
| 277 return (video_frame_provider_.get() != NULL); | 279 return (video_frame_provider_.get() != NULL); |
| 278 } | 280 } |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 } | 643 } |
| 642 | 644 |
| 643 unsigned WebMediaPlayerMS::Compositor::GetTotalFrameCount() { | 645 unsigned WebMediaPlayerMS::Compositor::GetTotalFrameCount() { |
| 644 return total_frame_count_; | 646 return total_frame_count_; |
| 645 } | 647 } |
| 646 | 648 |
| 647 unsigned WebMediaPlayerMS::Compositor::GetDroppedFrameCount() { | 649 unsigned WebMediaPlayerMS::Compositor::GetDroppedFrameCount() { |
| 648 return dropped_frame_count_; | 650 return dropped_frame_count_; |
| 649 } | 651 } |
| 650 } // namespace content | 652 } // namespace content |
| OLD | NEW |