| 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 media::cast::GetPort(&remote_port); | 446 media::cast::GetPort(&remote_port); |
| 447 | 447 |
| 448 std::string remote_ip_address = | 448 std::string remote_ip_address = |
| 449 media::cast::GetIpAddress("Enter receiver IP."); | 449 media::cast::GetIpAddress("Enter receiver IP."); |
| 450 | 450 |
| 451 media::cast::AudioSenderConfig audio_config = | 451 media::cast::AudioSenderConfig audio_config = |
| 452 media::cast::GetAudioSenderConfig(); | 452 media::cast::GetAudioSenderConfig(); |
| 453 media::cast::VideoSenderConfig video_config = | 453 media::cast::VideoSenderConfig video_config = |
| 454 media::cast::GetVideoSenderConfig(); | 454 media::cast::GetVideoSenderConfig(); |
| 455 | 455 |
| 456 // Enable main and send side threads only. Enable raw event logging. | |
| 457 // Running transport on the main thread. | 456 // Running transport on the main thread. |
| 458 media::cast::CastLoggingConfig logging_config; | |
| 459 logging_config.enable_raw_data_collection = true; | |
| 460 | |
| 461 // Setting up transport config. | 457 // Setting up transport config. |
| 462 media::cast::transport::CastTransportAudioConfig transport_audio_config; | 458 media::cast::transport::CastTransportAudioConfig transport_audio_config; |
| 463 media::cast::transport::CastTransportVideoConfig transport_video_config; | 459 media::cast::transport::CastTransportVideoConfig transport_video_config; |
| 464 net::IPEndPoint remote_endpoint = | 460 net::IPEndPoint remote_endpoint = |
| 465 CreateUDPAddress(remote_ip_address, remote_port); | 461 CreateUDPAddress(remote_ip_address, remote_port); |
| 466 transport_audio_config.base.ssrc = audio_config.sender_ssrc; | 462 transport_audio_config.base.ssrc = audio_config.sender_ssrc; |
| 467 transport_audio_config.base.rtp_config = audio_config.rtp_config; | 463 transport_audio_config.base.rtp_config = audio_config.rtp_config; |
| 468 transport_video_config.base.ssrc = video_config.sender_ssrc; | 464 transport_video_config.base.ssrc = video_config.sender_ssrc; |
| 469 transport_video_config.base.rtp_config = video_config.rtp_config; | 465 transport_video_config.base.rtp_config = video_config.rtp_config; |
| 470 | 466 |
| 471 // Enable raw event and stats logging. | 467 // Enable raw event and stats logging. |
| 472 // Running transport on the main thread. | 468 // Running transport on the main thread. |
| 473 scoped_refptr<media::cast::CastEnvironment> cast_environment( | 469 scoped_refptr<media::cast::CastEnvironment> cast_environment( |
| 474 new media::cast::CastEnvironment( | 470 new media::cast::CastEnvironment( |
| 475 make_scoped_ptr<base::TickClock>(new base::DefaultTickClock()), | 471 make_scoped_ptr<base::TickClock>(new base::DefaultTickClock()), |
| 476 io_message_loop.message_loop_proxy(), | 472 io_message_loop.message_loop_proxy(), |
| 477 audio_thread.message_loop_proxy(), | 473 audio_thread.message_loop_proxy(), |
| 478 video_thread.message_loop_proxy(), | 474 video_thread.message_loop_proxy())); |
| 479 media::cast::GetLoggingConfigWithRawEventsAndStatsEnabled())); | |
| 480 | 475 |
| 481 scoped_ptr<media::cast::transport::CastTransportSender> transport_sender = | 476 scoped_ptr<media::cast::transport::CastTransportSender> transport_sender = |
| 482 media::cast::transport::CastTransportSender::Create( | 477 media::cast::transport::CastTransportSender::Create( |
| 483 NULL, // net log. | 478 NULL, // net log. |
| 484 cast_environment->Clock(), | 479 cast_environment->Clock(), |
| 485 remote_endpoint, | 480 remote_endpoint, |
| 486 logging_config, | |
| 487 base::Bind(&UpdateCastTransportStatus), | 481 base::Bind(&UpdateCastTransportStatus), |
| 488 base::Bind(&LogRawEvents, cast_environment), | 482 base::Bind(&LogRawEvents, cast_environment), |
| 489 base::TimeDelta::FromSeconds(1), | 483 base::TimeDelta::FromSeconds(1), |
| 490 io_message_loop.message_loop_proxy()); | 484 io_message_loop.message_loop_proxy()); |
| 491 | 485 |
| 492 transport_sender->InitializeAudio(transport_audio_config); | 486 transport_sender->InitializeAudio(transport_audio_config); |
| 493 transport_sender->InitializeVideo(transport_video_config); | 487 transport_sender->InitializeVideo(transport_video_config); |
| 494 | 488 |
| 495 scoped_ptr<media::cast::CastSender> cast_sender = | 489 scoped_ptr<media::cast::CastSender> cast_sender = |
| 496 media::cast::CastSender::Create(cast_environment, transport_sender.get()); | 490 media::cast::CastSender::Create(cast_environment, transport_sender.get()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 | 555 |
| 562 test_thread.message_loop_proxy()->PostTask( | 556 test_thread.message_loop_proxy()->PostTask( |
| 563 FROM_HERE, | 557 FROM_HERE, |
| 564 base::Bind(&media::cast::SendProcess::SendFrame, | 558 base::Bind(&media::cast::SendProcess::SendFrame, |
| 565 base::Unretained(send_process.get()))); | 559 base::Unretained(send_process.get()))); |
| 566 | 560 |
| 567 io_message_loop.Run(); | 561 io_message_loop.Run(); |
| 568 | 562 |
| 569 return 0; | 563 return 0; |
| 570 } | 564 } |
| OLD | NEW |