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 = kOpus; | 115 audio_config.codec = transport::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 = kVp8; | 136 video_config.codec = transport::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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 scoped_ptr<media::cast::transport::Transport> transport( | 242 scoped_ptr<media::cast::transport::Transport> transport( |
243 new media::cast::transport::Transport( | 243 new media::cast::transport::Transport( |
244 main_message_loop.message_loop_proxy())); | 244 main_message_loop.message_loop_proxy())); |
245 scoped_ptr<media::cast::CastReceiver> cast_receiver( | 245 scoped_ptr<media::cast::CastReceiver> cast_receiver( |
246 media::cast::CastReceiver::CreateCastReceiver( | 246 media::cast::CastReceiver::CreateCastReceiver( |
247 cast_environment, | 247 cast_environment, |
248 audio_config, | 248 audio_config, |
249 video_config, | 249 video_config, |
250 transport->packet_sender())); | 250 transport->packet_sender())); |
251 | 251 |
252 media::cast::PacketReceiver* packet_receiver = | 252 media::cast::transport::PacketReceiver* packet_receiver = |
253 cast_receiver->packet_receiver(); | 253 cast_receiver->packet_receiver(); |
254 | 254 |
255 int send_to_port, receive_port; | 255 int send_to_port, receive_port; |
256 media::cast::GetPorts(&send_to_port, &receive_port); | 256 media::cast::GetPorts(&send_to_port, &receive_port); |
257 std::string ip_address = media::cast::GetIpAddress("Enter destination IP."); | 257 std::string ip_address = media::cast::GetIpAddress("Enter destination IP."); |
258 std::string local_ip_address = media::cast::GetIpAddress("Enter local IP."); | 258 std::string local_ip_address = media::cast::GetIpAddress("Enter local IP."); |
259 transport->SetLocalReceiver(packet_receiver, ip_address, local_ip_address, | 259 transport->SetLocalReceiver(packet_receiver, ip_address, local_ip_address, |
260 receive_port); | 260 receive_port); |
261 transport->SetSendDestination(ip_address, send_to_port); | 261 transport->SetSendDestination(ip_address, send_to_port); |
262 | 262 |
263 scoped_refptr<media::cast::ReceiveProcess> receive_process( | 263 scoped_refptr<media::cast::ReceiveProcess> receive_process( |
264 new media::cast::ReceiveProcess(cast_receiver->frame_receiver())); | 264 new media::cast::ReceiveProcess(cast_receiver->frame_receiver())); |
265 receive_process->Start(); | 265 receive_process->Start(); |
266 main_message_loop.Run(); | 266 main_message_loop.Run(); |
267 transport->StopReceiving(); | 267 transport->StopReceiving(); |
268 return 0; | 268 return 0; |
269 } | 269 } |
OLD | NEW |