| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <queue> | 11 #include <queue> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/at_exit.h" | 14 #include "base/at_exit.h" |
| 15 #include "base/base_paths.h" | 15 #include "base/base_paths.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
| 18 #include "base/json/json_writer.h" | 18 #include "base/json/json_writer.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| 21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
| 22 #include "base/run_loop.h" |
| 22 #include "base/single_thread_task_runner.h" | 23 #include "base/single_thread_task_runner.h" |
| 23 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/threading/thread.h" | 25 #include "base/threading/thread.h" |
| 25 #include "base/time/default_tick_clock.h" | 26 #include "base/time/default_tick_clock.h" |
| 26 #include "base/values.h" | 27 #include "base/values.h" |
| 27 #include "media/base/media.h" | 28 #include "media/base/media.h" |
| 28 #include "media/base/video_frame.h" | 29 #include "media/base/video_frame.h" |
| 29 #include "media/cast/cast_config.h" | 30 #include "media/cast/cast_config.h" |
| 30 #include "media/cast/cast_environment.h" | 31 #include "media/cast/cast_environment.h" |
| 31 #include "media/cast/cast_sender.h" | 32 #include "media/cast/cast_sender.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 std::unique_ptr<media::cast::CastSender> cast_sender = | 337 std::unique_ptr<media::cast::CastSender> cast_sender = |
| 337 media::cast::CastSender::Create(cast_environment, transport_sender.get()); | 338 media::cast::CastSender::Create(cast_environment, transport_sender.get()); |
| 338 io_message_loop.task_runner()->PostTask( | 339 io_message_loop.task_runner()->PostTask( |
| 339 FROM_HERE, | 340 FROM_HERE, |
| 340 base::Bind(&media::cast::CastSender::InitializeVideo, | 341 base::Bind(&media::cast::CastSender::InitializeVideo, |
| 341 base::Unretained(cast_sender.get()), | 342 base::Unretained(cast_sender.get()), |
| 342 fake_media_source->get_video_config(), | 343 fake_media_source->get_video_config(), |
| 343 base::Bind(&QuitLoopOnInitializationResult), | 344 base::Bind(&QuitLoopOnInitializationResult), |
| 344 media::cast::CreateDefaultVideoEncodeAcceleratorCallback(), | 345 media::cast::CreateDefaultVideoEncodeAcceleratorCallback(), |
| 345 media::cast::CreateDefaultVideoEncodeMemoryCallback())); | 346 media::cast::CreateDefaultVideoEncodeMemoryCallback())); |
| 346 io_message_loop.Run(); // Wait for video initialization. | 347 base::RunLoop().Run(); // Wait for video initialization. |
| 347 io_message_loop.task_runner()->PostTask( | 348 io_message_loop.task_runner()->PostTask( |
| 348 FROM_HERE, base::Bind(&media::cast::CastSender::InitializeAudio, | 349 FROM_HERE, base::Bind(&media::cast::CastSender::InitializeAudio, |
| 349 base::Unretained(cast_sender.get()), audio_config, | 350 base::Unretained(cast_sender.get()), audio_config, |
| 350 base::Bind(&QuitLoopOnInitializationResult))); | 351 base::Bind(&QuitLoopOnInitializationResult))); |
| 351 io_message_loop.Run(); // Wait for audio initialization. | 352 base::RunLoop().Run(); // Wait for audio initialization. |
| 352 | 353 |
| 353 fake_media_source->Start(cast_sender->audio_frame_input(), | 354 fake_media_source->Start(cast_sender->audio_frame_input(), |
| 354 cast_sender->video_frame_input()); | 355 cast_sender->video_frame_input()); |
| 355 io_message_loop.Run(); | 356 base::RunLoop().Run(); |
| 356 return 0; | 357 return 0; |
| 357 } | 358 } |
| OLD | NEW |