| 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 base::TimeDelta::FromSeconds(1), | 490 base::TimeDelta::FromSeconds(1), |
| 490 io_message_loop.message_loop_proxy()); | 491 io_message_loop.message_loop_proxy()); |
| 491 | 492 |
| 492 transport_sender->InitializeAudio(transport_audio_config); | 493 transport_sender->InitializeAudio(transport_audio_config); |
| 493 transport_sender->InitializeVideo(transport_video_config); | 494 transport_sender->InitializeVideo(transport_video_config); |
| 494 | 495 |
| 495 scoped_ptr<media::cast::CastSender> cast_sender = | 496 scoped_ptr<media::cast::CastSender> cast_sender = |
| 496 media::cast::CastSender::Create(cast_environment, transport_sender.get()); | 497 media::cast::CastSender::Create(cast_environment, transport_sender.get()); |
| 497 | 498 |
| 498 cast_sender->InitializeVideo( | 499 cast_sender->InitializeVideo( |
| 499 video_config, base::Bind(&InitializationResult), NULL); | 500 video_config, |
| 501 base::Bind(&InitializationResult), |
| 502 media::cast::CreateDefaultVideoEncodeAcceleratorCallback(), |
| 503 media::cast::CreateDefaultVideoEncodeMemoryCallback()); |
| 504 |
| 500 cast_sender->InitializeAudio(audio_config, base::Bind(&InitializationResult)); | 505 cast_sender->InitializeAudio(audio_config, base::Bind(&InitializationResult)); |
| 501 | 506 |
| 502 transport_sender->SetPacketReceiver(cast_sender->packet_receiver()); | 507 transport_sender->SetPacketReceiver(cast_sender->packet_receiver()); |
| 503 | 508 |
| 504 scoped_refptr<media::cast::AudioFrameInput> audio_frame_input = | 509 scoped_refptr<media::cast::AudioFrameInput> audio_frame_input = |
| 505 cast_sender->audio_frame_input(); | 510 cast_sender->audio_frame_input(); |
| 506 scoped_refptr<media::cast::VideoFrameInput> video_frame_input = | 511 scoped_refptr<media::cast::VideoFrameInput> video_frame_input = |
| 507 cast_sender->video_frame_input(); | 512 cast_sender->video_frame_input(); |
| 508 scoped_ptr<media::cast::SendProcess> send_process( | 513 scoped_ptr<media::cast::SendProcess> send_process( |
| 509 new media::cast::SendProcess(test_thread.message_loop_proxy(), | 514 new media::cast::SendProcess(test_thread.message_loop_proxy(), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 | 562 |
| 558 test_thread.message_loop_proxy()->PostTask( | 563 test_thread.message_loop_proxy()->PostTask( |
| 559 FROM_HERE, | 564 FROM_HERE, |
| 560 base::Bind(&media::cast::SendProcess::SendFrame, | 565 base::Bind(&media::cast::SendProcess::SendFrame, |
| 561 base::Unretained(send_process.get()))); | 566 base::Unretained(send_process.get()))); |
| 562 | 567 |
| 563 io_message_loop.Run(); | 568 io_message_loop.Run(); |
| 564 | 569 |
| 565 return 0; | 570 return 0; |
| 566 } | 571 } |
| OLD | NEW |