| 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 // Test application that simulates a cast sender - Data can be either generated | 5 // Test application that simulates a cast sender - Data can be either generated |
| 6 // or read from a file. | 6 // or read from a file. |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 327 |
| 328 std::string remote_ip_address = | 328 std::string remote_ip_address = |
| 329 media::cast::GetIpAddress("Enter receiver IP."); | 329 media::cast::GetIpAddress("Enter receiver IP."); |
| 330 | 330 |
| 331 media::cast::AudioSenderConfig audio_config = | 331 media::cast::AudioSenderConfig audio_config = |
| 332 media::cast::GetAudioSenderConfig(); | 332 media::cast::GetAudioSenderConfig(); |
| 333 media::cast::VideoSenderConfig video_config = | 333 media::cast::VideoSenderConfig video_config = |
| 334 media::cast::GetVideoSenderConfig(); | 334 media::cast::GetVideoSenderConfig(); |
| 335 | 335 |
| 336 // Setting up transport config. | 336 // Setting up transport config. |
| 337 media::cast::transport::CastTransportConfig config; | 337 media::cast::transport::CastTransportAudioConfig transport_audio_config; |
| 338 config.receiver_endpoint = CreateUDPAddress(remote_ip_address, remote_port); | 338 media::cast::transport::CastTransportVideoConfig transport_video_config; |
| 339 config.local_endpoint = CreateUDPAddress("0.0.0.0", 0); | 339 net::IPEndPoint remote_endpoint = |
| 340 config.audio_ssrc = audio_config.sender_ssrc; | 340 CreateUDPAddress(remote_ip_address, remote_port); |
| 341 config.video_ssrc = video_config.sender_ssrc; | 341 net::IPEndPoint local_endpoint = CreateUDPAddress("0.0.0.0", 0); |
| 342 config.audio_rtp_config = audio_config.rtp_config; | 342 transport_audio_config.base.ssrc = audio_config.sender_ssrc; |
| 343 config.video_rtp_config = video_config.rtp_config; | 343 transport_audio_config.base.rtp_config = audio_config.rtp_config; |
| 344 transport_video_config.base.ssrc = video_config.sender_ssrc; |
| 345 transport_video_config.base.rtp_config = video_config.rtp_config; |
| 344 | 346 |
| 345 scoped_ptr<media::cast::transport::CastTransportSender> transport_sender( | 347 scoped_ptr<media::cast::transport::CastTransportSender> transport_sender = |
| 346 media::cast::transport::CastTransportSender::CreateCastTransportSender( | 348 media::cast::transport::CastTransportSender::Create( |
| 347 clock.get(), | 349 clock.get(), |
| 348 config, | 350 local_endpoint, |
| 351 remote_endpoint, |
| 349 base::Bind(&UpdateCastTransportStatus), | 352 base::Bind(&UpdateCastTransportStatus), |
| 350 io_message_loop.message_loop_proxy())); | 353 io_message_loop.message_loop_proxy()); |
| 354 |
| 355 transport_sender->InitializeAudio(transport_audio_config); |
| 356 transport_sender->InitializeVideo(transport_video_config); |
| 351 | 357 |
| 352 // Enable main and send side threads only. Disable logging. | 358 // Enable main and send side threads only. Disable logging. |
| 353 // Running transport on the main thread. | 359 // Running transport on the main thread. |
| 354 scoped_refptr<media::cast::CastEnvironment> cast_environment( | 360 scoped_refptr<media::cast::CastEnvironment> cast_environment( |
| 355 new media::cast::CastEnvironment( | 361 new media::cast::CastEnvironment( |
| 356 clock.Pass(), | 362 clock.Pass(), |
| 357 io_message_loop.message_loop_proxy(), | 363 io_message_loop.message_loop_proxy(), |
| 358 audio_thread.message_loop_proxy(), | 364 audio_thread.message_loop_proxy(), |
| 359 NULL, | 365 NULL, |
| 360 video_thread.message_loop_proxy(), | 366 video_thread.message_loop_proxy(), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 381 frame_input)); | 387 frame_input)); |
| 382 | 388 |
| 383 test_thread.message_loop_proxy()->PostTask( | 389 test_thread.message_loop_proxy()->PostTask( |
| 384 FROM_HERE, | 390 FROM_HERE, |
| 385 base::Bind(&media::cast::SendProcess::SendFrame, | 391 base::Bind(&media::cast::SendProcess::SendFrame, |
| 386 base::Unretained(send_process.get()))); | 392 base::Unretained(send_process.get()))); |
| 387 | 393 |
| 388 io_message_loop.Run(); | 394 io_message_loop.Run(); |
| 389 return 0; | 395 return 0; |
| 390 } | 396 } |
| OLD | NEW |