| 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" |
| 11 #include "base/files/scoped_file.h" | 11 #include "base/files/scoped_file.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "base/time/default_tick_clock.h" | 15 #include "base/time/default_tick_clock.h" |
| 16 #include "media/base/video_frame.h" | 16 #include "media/base/video_frame.h" |
| 17 #include "media/cast/cast_config.h" | 17 #include "media/cast/cast_config.h" |
| 18 #include "media/cast/cast_environment.h" | 18 #include "media/cast/cast_environment.h" |
| 19 #include "media/cast/cast_sender.h" | 19 #include "media/cast/cast_sender.h" |
| 20 #include "media/cast/logging/encoding_event_subscriber.h" | 20 #include "media/cast/logging/encoding_event_subscriber.h" |
| 21 #include "media/cast/logging/log_serializer.h" | 21 #include "media/cast/logging/log_serializer.h" |
| 22 #include "media/cast/logging/logging_defines.h" | 22 #include "media/cast/logging/logging_defines.h" |
| 23 #include "media/cast/logging/proto/raw_events.pb.h" | 23 #include "media/cast/logging/proto/raw_events.pb.h" |
| 24 #include "media/cast/test/utility/audio_utility.h" | 24 #include "media/cast/test/utility/audio_utility.h" |
| 25 #include "media/cast/test/utility/default_config.h" |
| 25 #include "media/cast/test/utility/input_builder.h" | 26 #include "media/cast/test/utility/input_builder.h" |
| 26 #include "media/cast/test/utility/video_utility.h" | 27 #include "media/cast/test/utility/video_utility.h" |
| 27 #include "media/cast/transport/cast_transport_defines.h" | 28 #include "media/cast/transport/cast_transport_defines.h" |
| 28 #include "media/cast/transport/cast_transport_sender.h" | 29 #include "media/cast/transport/cast_transport_sender.h" |
| 29 #include "media/cast/transport/transport/udp_transport.h" | 30 #include "media/cast/transport/transport/udp_transport.h" |
| 30 #include "ui/gfx/size.h" | 31 #include "ui/gfx/size.h" |
| 31 | 32 |
| 32 namespace media { | 33 namespace media { |
| 33 namespace cast { | 34 namespace cast { |
| 34 // Settings chosen to match default receiver settings. | 35 // Settings chosen to match default receiver settings. |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 base::TimeDelta::FromSeconds(1), | 492 base::TimeDelta::FromSeconds(1), |
| 492 io_message_loop.message_loop_proxy()); | 493 io_message_loop.message_loop_proxy()); |
| 493 | 494 |
| 494 transport_sender->InitializeAudio(transport_audio_config); | 495 transport_sender->InitializeAudio(transport_audio_config); |
| 495 transport_sender->InitializeVideo(transport_video_config); | 496 transport_sender->InitializeVideo(transport_video_config); |
| 496 | 497 |
| 497 scoped_ptr<media::cast::CastSender> cast_sender = | 498 scoped_ptr<media::cast::CastSender> cast_sender = |
| 498 media::cast::CastSender::Create(cast_environment, transport_sender.get()); | 499 media::cast::CastSender::Create(cast_environment, transport_sender.get()); |
| 499 | 500 |
| 500 cast_sender->InitializeVideo( | 501 cast_sender->InitializeVideo( |
| 501 video_config, base::Bind(&InitializationResult), NULL); | 502 video_config, |
| 503 base::Bind(&InitializationResult), |
| 504 media::cast::CreateDefaultVideoEncodeAcceleratorCallback(), |
| 505 media::cast::CreateDefaultVideoEncodeMemoryCallback()); |
| 506 |
| 502 cast_sender->InitializeAudio(audio_config, base::Bind(&InitializationResult)); | 507 cast_sender->InitializeAudio(audio_config, base::Bind(&InitializationResult)); |
| 503 | 508 |
| 504 transport_sender->SetPacketReceiver(cast_sender->packet_receiver()); | 509 transport_sender->SetPacketReceiver(cast_sender->packet_receiver()); |
| 505 | 510 |
| 506 scoped_refptr<media::cast::AudioFrameInput> audio_frame_input = | 511 scoped_refptr<media::cast::AudioFrameInput> audio_frame_input = |
| 507 cast_sender->audio_frame_input(); | 512 cast_sender->audio_frame_input(); |
| 508 scoped_refptr<media::cast::VideoFrameInput> video_frame_input = | 513 scoped_refptr<media::cast::VideoFrameInput> video_frame_input = |
| 509 cast_sender->video_frame_input(); | 514 cast_sender->video_frame_input(); |
| 510 scoped_ptr<media::cast::SendProcess> send_process( | 515 scoped_ptr<media::cast::SendProcess> send_process( |
| 511 new media::cast::SendProcess(test_thread.message_loop_proxy(), | 516 new media::cast::SendProcess(test_thread.message_loop_proxy(), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 | 564 |
| 560 test_thread.message_loop_proxy()->PostTask( | 565 test_thread.message_loop_proxy()->PostTask( |
| 561 FROM_HERE, | 566 FROM_HERE, |
| 562 base::Bind(&media::cast::SendProcess::SendFrame, | 567 base::Bind(&media::cast::SendProcess::SendFrame, |
| 563 base::Unretained(send_process.get()))); | 568 base::Unretained(send_process.get()))); |
| 564 | 569 |
| 565 io_message_loop.Run(); | 570 io_message_loop.Run(); |
| 566 | 571 |
| 567 return 0; | 572 return 0; |
| 568 } | 573 } |
| OLD | NEW |