| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <climits> | 6 #include <climits> |
| 7 #include <cstdarg> | 7 #include <cstdarg> |
| 8 #include <cstdio> | 8 #include <cstdio> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 GetSsrcs(&audio_config); | 106 GetSsrcs(&audio_config); |
| 107 GetPayloadtype(&audio_config); | 107 GetPayloadtype(&audio_config); |
| 108 | 108 |
| 109 audio_config.rtcp_c_name = "audio_receiver@a.b.c.d"; | 109 audio_config.rtcp_c_name = "audio_receiver@a.b.c.d"; |
| 110 | 110 |
| 111 VLOG(1) << "Using OPUS 48Khz stereo"; | 111 VLOG(1) << "Using OPUS 48Khz stereo"; |
| 112 audio_config.use_external_decoder = false; | 112 audio_config.use_external_decoder = false; |
| 113 audio_config.frequency = 48000; | 113 audio_config.frequency = 48000; |
| 114 audio_config.channels = 2; | 114 audio_config.channels = 2; |
| 115 audio_config.codec = transport::kOpus; | 115 audio_config.codec = kOpus; |
| 116 return audio_config; | 116 return audio_config; |
| 117 } | 117 } |
| 118 | 118 |
| 119 void GetPayloadtype(VideoReceiverConfig* video_config) { | 119 void GetPayloadtype(VideoReceiverConfig* video_config) { |
| 120 test::InputBuilder input("Choose video receiver payload type.", | 120 test::InputBuilder input("Choose video receiver payload type.", |
| 121 DEFAULT_VIDEO_PAYLOAD_TYPE, 96, 127); | 121 DEFAULT_VIDEO_PAYLOAD_TYPE, 96, 127); |
| 122 video_config->rtp_payload_type = input.GetIntInput(); | 122 video_config->rtp_payload_type = input.GetIntInput(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 VideoReceiverConfig GetVideoReceiverConfig() { | 125 VideoReceiverConfig GetVideoReceiverConfig() { |
| 126 VideoReceiverConfig video_config; | 126 VideoReceiverConfig video_config; |
| 127 | 127 |
| 128 GetSsrcs(&video_config); | 128 GetSsrcs(&video_config); |
| 129 GetPayloadtype(&video_config); | 129 GetPayloadtype(&video_config); |
| 130 | 130 |
| 131 video_config.rtcp_c_name = "video_receiver@a.b.c.d"; | 131 video_config.rtcp_c_name = "video_receiver@a.b.c.d"; |
| 132 | 132 |
| 133 video_config.use_external_decoder = false; | 133 video_config.use_external_decoder = false; |
| 134 | 134 |
| 135 VLOG(1) << "Using VP8"; | 135 VLOG(1) << "Using VP8"; |
| 136 video_config.codec = transport::kVp8; | 136 video_config.codec = kVp8; |
| 137 return video_config; | 137 return video_config; |
| 138 } | 138 } |
| 139 | 139 |
| 140 | 140 |
| 141 class ReceiveProcess : public base::RefCountedThreadSafe<ReceiveProcess> { | 141 class ReceiveProcess : public base::RefCountedThreadSafe<ReceiveProcess> { |
| 142 public: | 142 public: |
| 143 explicit ReceiveProcess(scoped_refptr<FrameReceiver> frame_receiver) | 143 explicit ReceiveProcess(scoped_refptr<FrameReceiver> frame_receiver) |
| 144 : frame_receiver_(frame_receiver), | 144 : frame_receiver_(frame_receiver), |
| 145 #if defined(OS_LINUX) | 145 #if defined(OS_LINUX) |
| 146 render_(0, 0, kVideoWindowWidth, kVideoWindowHeight, "Cast_receiver"), | 146 render_(0, 0, kVideoWindowWidth, kVideoWindowHeight, "Cast_receiver"), |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 base::DefaultTickClock clock; | 226 base::DefaultTickClock clock; |
| 227 // Enable receiver side threads, and disable logging. | 227 // Enable receiver side threads, and disable logging. |
| 228 scoped_refptr<media::cast::CastEnvironment> cast_environment(new | 228 scoped_refptr<media::cast::CastEnvironment> cast_environment(new |
| 229 media::cast::CastEnvironment(&clock, | 229 media::cast::CastEnvironment(&clock, |
| 230 main_thread.message_loop_proxy(), | 230 main_thread.message_loop_proxy(), |
| 231 NULL, | 231 NULL, |
| 232 audio_thread.message_loop_proxy(), | 232 audio_thread.message_loop_proxy(), |
| 233 NULL, | 233 NULL, |
| 234 video_thread.message_loop_proxy(), | 234 video_thread.message_loop_proxy(), |
| 235 main_thread.message_loop_proxy(), | |
| 236 media::cast::GetDefaultCastLoggingConfig())); | 235 media::cast::GetDefaultCastLoggingConfig())); |
| 237 | 236 |
| 238 media::cast::AudioReceiverConfig audio_config = | 237 media::cast::AudioReceiverConfig audio_config = |
| 239 media::cast::GetAudioReceiverConfig(); | 238 media::cast::GetAudioReceiverConfig(); |
| 240 media::cast::VideoReceiverConfig video_config = | 239 media::cast::VideoReceiverConfig video_config = |
| 241 media::cast::GetVideoReceiverConfig(); | 240 media::cast::GetVideoReceiverConfig(); |
| 242 | 241 |
| 243 scoped_ptr<media::cast::transport::Transport> transport( | 242 scoped_ptr<media::cast::transport::Transport> transport( |
| 244 new media::cast::transport::Transport( | 243 new media::cast::transport::Transport( |
| 245 main_message_loop.message_loop_proxy())); | 244 main_message_loop.message_loop_proxy())); |
| 246 scoped_ptr<media::cast::CastReceiver> cast_receiver( | 245 scoped_ptr<media::cast::CastReceiver> cast_receiver( |
| 247 media::cast::CastReceiver::CreateCastReceiver( | 246 media::cast::CastReceiver::CreateCastReceiver( |
| 248 cast_environment, | 247 cast_environment, |
| 249 audio_config, | 248 audio_config, |
| 250 video_config, | 249 video_config, |
| 251 transport->packet_sender())); | 250 transport->packet_sender())); |
| 252 | 251 |
| 253 media::cast::transport::PacketReceiver* packet_receiver = | 252 media::cast::PacketReceiver* packet_receiver = |
| 254 cast_receiver->packet_receiver(); | 253 cast_receiver->packet_receiver(); |
| 255 | 254 |
| 256 int send_to_port, receive_port; | 255 int send_to_port, receive_port; |
| 257 media::cast::GetPorts(&send_to_port, &receive_port); | 256 media::cast::GetPorts(&send_to_port, &receive_port); |
| 258 std::string ip_address = media::cast::GetIpAddress("Enter destination IP."); | 257 std::string ip_address = media::cast::GetIpAddress("Enter destination IP."); |
| 259 std::string local_ip_address = media::cast::GetIpAddress("Enter local IP."); | 258 std::string local_ip_address = media::cast::GetIpAddress("Enter local IP."); |
| 260 transport->SetLocalReceiver(packet_receiver, ip_address, local_ip_address, | 259 transport->SetLocalReceiver(packet_receiver, ip_address, local_ip_address, |
| 261 receive_port); | 260 receive_port); |
| 262 transport->SetSendDestination(ip_address, send_to_port); | 261 transport->SetSendDestination(ip_address, send_to_port); |
| 263 | 262 |
| 264 scoped_refptr<media::cast::ReceiveProcess> receive_process( | 263 scoped_refptr<media::cast::ReceiveProcess> receive_process( |
| 265 new media::cast::ReceiveProcess(cast_receiver->frame_receiver())); | 264 new media::cast::ReceiveProcess(cast_receiver->frame_receiver())); |
| 266 receive_process->Start(); | 265 receive_process->Start(); |
| 267 main_message_loop.Run(); | 266 main_message_loop.Run(); |
| 268 transport->StopReceiving(); | 267 transport->StopReceiving(); |
| 269 return 0; | 268 return 0; |
| 270 } | 269 } |
| OLD | NEW |