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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
9 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
10 #include "media/cast/cast_environment.h" | 10 #include "media/cast/cast_environment.h" |
11 #include "media/cast/cast_sender.h" | 11 #include "media/cast/cast_sender.h" |
| 12 #include "media/cast/logging/logging_defines.h" |
12 | 13 |
13 using media::cast::AudioSenderConfig; | 14 using media::cast::AudioSenderConfig; |
14 using media::cast::CastEnvironment; | 15 using media::cast::CastEnvironment; |
15 using media::cast::CastSender; | 16 using media::cast::CastSender; |
16 using media::cast::VideoSenderConfig; | 17 using media::cast::VideoSenderConfig; |
17 | 18 |
18 CastSessionDelegate::CastSessionDelegate() | 19 CastSessionDelegate::CastSessionDelegate() |
19 : audio_encode_thread_("CastAudioEncodeThread"), | 20 : audio_encode_thread_("CastAudioEncodeThread"), |
20 video_encode_thread_("CastVideoEncodeThread"), | 21 video_encode_thread_("CastVideoEncodeThread"), |
21 audio_configured_(false), | 22 audio_configured_(false), |
(...skipping 27 matching lines...) Expand all Loading... |
49 | 50 |
50 if (cast_environment_) | 51 if (cast_environment_) |
51 return; | 52 return; |
52 | 53 |
53 audio_encode_thread_.Start(); | 54 audio_encode_thread_.Start(); |
54 video_encode_thread_.Start(); | 55 video_encode_thread_.Start(); |
55 | 56 |
56 // CastSender uses the renderer's IO thread as the main thread. This reduces | 57 // CastSender uses the renderer's IO thread as the main thread. This reduces |
57 // thread hopping for incoming video frames and outgoing network packets. | 58 // thread hopping for incoming video frames and outgoing network packets. |
58 // There's no need to decode so no thread assigned for decoding. | 59 // There's no need to decode so no thread assigned for decoding. |
| 60 // Get default logging: All disabled. |
59 cast_environment_ = new CastEnvironment( | 61 cast_environment_ = new CastEnvironment( |
60 &clock_, | 62 &clock_, |
61 base::MessageLoopProxy::current(), | 63 base::MessageLoopProxy::current(), |
62 audio_encode_thread_.message_loop_proxy(), | 64 audio_encode_thread_.message_loop_proxy(), |
63 NULL, | 65 NULL, |
64 video_encode_thread_.message_loop_proxy(), | 66 video_encode_thread_.message_loop_proxy(), |
65 NULL); | 67 NULL, |
| 68 media::cast::GetDefaultCastLoggingConfig()); |
66 | 69 |
67 // TODO(hclam): A couple things need to be done here: | 70 // TODO(hclam): A couple things need to be done here: |
68 // 1. Connect media::cast::PacketSender to net::Socket interface. | 71 // 1. Connect media::cast::PacketSender to net::Socket interface. |
69 // 2. Implement VideoEncoderController to configure hardware encoder. | 72 // 2. Implement VideoEncoderController to configure hardware encoder. |
70 cast_sender_.reset(CastSender::CreateCastSender( | 73 cast_sender_.reset(CastSender::CreateCastSender( |
71 cast_environment_, | 74 cast_environment_, |
72 audio_config_, | 75 audio_config_, |
73 video_config_, | 76 video_config_, |
74 NULL, | 77 NULL, |
75 NULL)); | 78 NULL)); |
76 } | 79 } |
77 | 80 |
78 void CastSessionDelegate::MaybeStartSending() { | 81 void CastSessionDelegate::MaybeStartSending() { |
79 if (!audio_configured_ || !video_configured_) | 82 if (!audio_configured_ || !video_configured_) |
80 return; | 83 return; |
81 StartSending(); | 84 StartSending(); |
82 } | 85 } |
OLD | NEW |