| 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 <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/task_runner.h" | 14 #include "base/task_runner.h" |
| 15 #include "base/time/default_tick_clock.h" | 15 #include "base/time/default_tick_clock.h" |
| 16 #include "media/cast/cast_config.h" | 16 #include "media/cast/cast_config.h" |
| 17 #include "media/cast/cast_environment.h" | 17 #include "media/cast/cast_environment.h" |
| 18 #include "media/cast/cast_sender.h" | 18 #include "media/cast/cast_sender.h" |
| 19 #include "media/cast/logging/logging_defines.h" |
| 19 #include "media/cast/test/audio_utility.h" | 20 #include "media/cast/test/audio_utility.h" |
| 20 #include "media/cast/test/transport/transport.h" | 21 #include "media/cast/test/transport/transport.h" |
| 21 #include "media/cast/test/utility/input_helper.h" | 22 #include "media/cast/test/utility/input_helper.h" |
| 22 #include "media/cast/test/video_utility.h" | 23 #include "media/cast/test/video_utility.h" |
| 23 | 24 |
| 24 #define DEFAULT_SEND_PORT "2344" | 25 #define DEFAULT_SEND_PORT "2344" |
| 25 #define DEFAULT_RECEIVE_PORT "2346" | 26 #define DEFAULT_RECEIVE_PORT "2346" |
| 26 #define DEFAULT_SEND_IP "127.0.0.1" | 27 #define DEFAULT_SEND_IP "127.0.0.1" |
| 27 #define DEFAULT_READ_FROM_FILE "0" | 28 #define DEFAULT_READ_FROM_FILE "0" |
| 28 #define DEFAULT_PACKET_LOSS "0" | 29 #define DEFAULT_PACKET_LOSS "0" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 278 |
| 278 | 279 |
| 279 int main(int argc, char** argv) { | 280 int main(int argc, char** argv) { |
| 280 base::AtExitManager at_exit; | 281 base::AtExitManager at_exit; |
| 281 VLOG(1) << "Cast Sender"; | 282 VLOG(1) << "Cast Sender"; |
| 282 base::DefaultTickClock clock; | 283 base::DefaultTickClock clock; |
| 283 base::MessageLoopForIO main_message_loop; | 284 base::MessageLoopForIO main_message_loop; |
| 284 scoped_refptr<base::SequencedTaskRunner> | 285 scoped_refptr<base::SequencedTaskRunner> |
| 285 task_runner(main_message_loop.message_loop_proxy()); | 286 task_runner(main_message_loop.message_loop_proxy()); |
| 286 | 287 |
| 287 // Enable main and send side threads only. | 288 // Enable main and send side threads only. Disable logging. |
| 289 media::cast::CastLoggingConfig logging_config; |
| 288 scoped_refptr<media::cast::CastEnvironment> cast_environment(new | 290 scoped_refptr<media::cast::CastEnvironment> cast_environment(new |
| 289 media::cast::CastEnvironment(&clock, task_runner, task_runner, NULL, | 291 media::cast::CastEnvironment(&clock, task_runner, task_runner, NULL, |
| 290 task_runner, NULL)); | 292 task_runner, NULL, media::cast::GetDefaultCastLoggingConfig())); |
| 291 | 293 |
| 292 media::cast::AudioSenderConfig audio_config = | 294 media::cast::AudioSenderConfig audio_config = |
| 293 media::cast::GetAudioSenderConfig(); | 295 media::cast::GetAudioSenderConfig(); |
| 294 media::cast::VideoSenderConfig video_config = | 296 media::cast::VideoSenderConfig video_config = |
| 295 media::cast::GetVideoSenderConfig(); | 297 media::cast::GetVideoSenderConfig(); |
| 296 | 298 |
| 297 scoped_ptr<media::cast::test::Transport> | 299 scoped_ptr<media::cast::test::Transport> |
| 298 transport(new media::cast::test::Transport(cast_environment)); | 300 transport(new media::cast::test::Transport(cast_environment)); |
| 299 scoped_ptr<media::cast::CastSender> cast_sender( | 301 scoped_ptr<media::cast::CastSender> cast_sender( |
| 300 media::cast::CastSender::CreateCastSender(cast_environment, | 302 media::cast::CastSender::CreateCastSender(cast_environment, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 318 | 320 |
| 319 media::cast::FrameInput* frame_input = cast_sender->frame_input(); | 321 media::cast::FrameInput* frame_input = cast_sender->frame_input(); |
| 320 scoped_ptr<media::cast::SendProcess> send_process(new | 322 scoped_ptr<media::cast::SendProcess> send_process(new |
| 321 media::cast::SendProcess(cast_environment, video_config, frame_input)); | 323 media::cast::SendProcess(cast_environment, video_config, frame_input)); |
| 322 | 324 |
| 323 send_process->SendFrame(); | 325 send_process->SendFrame(); |
| 324 main_message_loop.Run(); | 326 main_message_loop.Run(); |
| 325 transport->StopReceiving(); | 327 transport->StopReceiving(); |
| 326 return 0; | 328 return 0; |
| 327 } | 329 } |
| OLD | NEW |