| 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 "chrome/renderer/media/cast_session_delegate.h" | 5 #include "chrome/renderer/media/cast_session_delegate.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "chrome/renderer/media/cast_threads.h" | 10 #include "chrome/renderer/media/cast_threads.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 void CastSessionDelegate::Initialize() { | 62 void CastSessionDelegate::Initialize() { |
| 63 if (cast_environment_) | 63 if (cast_environment_) |
| 64 return; // Already initialized. | 64 return; // Already initialized. |
| 65 | 65 |
| 66 // CastSender uses the renderer's IO thread as the main thread. This reduces | 66 // CastSender uses the renderer's IO thread as the main thread. This reduces |
| 67 // thread hopping for incoming video frames and outgoing network packets. | 67 // thread hopping for incoming video frames and outgoing network packets. |
| 68 // There's no need to decode so no thread assigned for decoding. | 68 // There's no need to decode so no thread assigned for decoding. |
| 69 // Get default logging: All disabled. | 69 // Logging: enable raw events and stats collection. |
| 70 cast_environment_ = new CastEnvironment( | 70 cast_environment_ = new CastEnvironment( |
| 71 scoped_ptr<base::TickClock>(new base::DefaultTickClock()).Pass(), | 71 scoped_ptr<base::TickClock>(new base::DefaultTickClock()).Pass(), |
| 72 base::MessageLoopProxy::current(), | 72 base::MessageLoopProxy::current(), |
| 73 g_cast_threads.Get().GetAudioEncodeMessageLoopProxy(), | 73 g_cast_threads.Get().GetAudioEncodeMessageLoopProxy(), |
| 74 NULL, | 74 NULL, |
| 75 g_cast_threads.Get().GetVideoEncodeMessageLoopProxy(), | 75 g_cast_threads.Get().GetVideoEncodeMessageLoopProxy(), |
| 76 NULL, | 76 NULL, |
| 77 base::MessageLoopProxy::current(), | 77 base::MessageLoopProxy::current(), |
| 78 media::cast::GetDefaultCastSenderLoggingConfig()); | 78 media::cast::GetLoggingConfigWithRawEventsAndStatsEnabled()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void CastSessionDelegate::StartAudio( | 81 void CastSessionDelegate::StartAudio( |
| 82 const AudioSenderConfig& config, | 82 const AudioSenderConfig& config, |
| 83 const FrameInputAvailableCallback& callback) { | 83 const FrameInputAvailableCallback& callback) { |
| 84 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); | 84 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); |
| 85 | 85 |
| 86 audio_config_.reset(new AudioSenderConfig(config)); | 86 audio_config_.reset(new AudioSenderConfig(config)); |
| 87 video_frame_input_available_callback_ = callback; | 87 video_frame_input_available_callback_ = callback; |
| 88 StartSendingInternal(); | 88 StartSendingInternal(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // TODO(pwestin): handle the error codes. | 192 // TODO(pwestin): handle the error codes. |
| 193 if (result == media::cast::STATUS_INITIALIZED) { | 193 if (result == media::cast::STATUS_INITIALIZED) { |
| 194 if (!audio_frame_input_available_callback_.is_null()) { | 194 if (!audio_frame_input_available_callback_.is_null()) { |
| 195 audio_frame_input_available_callback_.Run(cast_sender_->frame_input()); | 195 audio_frame_input_available_callback_.Run(cast_sender_->frame_input()); |
| 196 } | 196 } |
| 197 if (!video_frame_input_available_callback_.is_null()) { | 197 if (!video_frame_input_available_callback_.is_null()) { |
| 198 video_frame_input_available_callback_.Run(cast_sender_->frame_input()); | 198 video_frame_input_available_callback_.Run(cast_sender_->frame_input()); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 } | 201 } |
| OLD | NEW |