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 <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 media::cast::CastTransportStatus status) { | 69 media::cast::CastTransportStatus status) { |
70 VLOG(1) << "Transport status: " << status; | 70 VLOG(1) << "Transport status: " << status; |
71 } | 71 } |
72 | 72 |
73 void QuitLoopOnInitializationResult(media::cast::OperationalStatus result) { | 73 void QuitLoopOnInitializationResult(media::cast::OperationalStatus result) { |
74 CHECK(result == media::cast::STATUS_INITIALIZED) | 74 CHECK(result == media::cast::STATUS_INITIALIZED) |
75 << "Cast sender uninitialized"; | 75 << "Cast sender uninitialized"; |
76 base::MessageLoop::current()->QuitWhenIdle(); | 76 base::MessageLoop::current()->QuitWhenIdle(); |
77 } | 77 } |
78 | 78 |
79 net::IPEndPoint CreateUDPAddress(const std::string& ip_str, uint16 port) { | 79 net::IPEndPoint CreateUDPAddress(const std::string& ip_str, uint16_t port) { |
80 net::IPAddressNumber ip_number; | 80 net::IPAddressNumber ip_number; |
81 CHECK(net::ParseIPLiteralToNumber(ip_str, &ip_number)); | 81 CHECK(net::ParseIPLiteralToNumber(ip_str, &ip_number)); |
82 return net::IPEndPoint(ip_number, port); | 82 return net::IPEndPoint(ip_number, port); |
83 } | 83 } |
84 | 84 |
85 void DumpLoggingData(const media::cast::proto::LogMetadata& log_metadata, | 85 void DumpLoggingData(const media::cast::proto::LogMetadata& log_metadata, |
86 const media::cast::FrameEventList& frame_events, | 86 const media::cast::FrameEventList& frame_events, |
87 const media::cast::PacketEventList& packet_events, | 87 const media::cast::PacketEventList& packet_events, |
88 base::ScopedFILE log_file) { | 88 base::ScopedFILE log_file) { |
89 VLOG(0) << "Frame map size: " << frame_events.size(); | 89 VLOG(0) << "Frame map size: " << frame_events.size(); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 << "."; | 195 << "."; |
196 | 196 |
197 media::cast::AudioSenderConfig audio_config = | 197 media::cast::AudioSenderConfig audio_config = |
198 media::cast::GetDefaultAudioSenderConfig(); | 198 media::cast::GetDefaultAudioSenderConfig(); |
199 media::cast::VideoSenderConfig video_config = | 199 media::cast::VideoSenderConfig video_config = |
200 media::cast::GetDefaultVideoSenderConfig(); | 200 media::cast::GetDefaultVideoSenderConfig(); |
201 | 201 |
202 // Running transport on the main thread. | 202 // Running transport on the main thread. |
203 // Setting up transport config. | 203 // Setting up transport config. |
204 net::IPEndPoint remote_endpoint = | 204 net::IPEndPoint remote_endpoint = |
205 CreateUDPAddress(remote_ip_address, static_cast<uint16>(remote_port)); | 205 CreateUDPAddress(remote_ip_address, static_cast<uint16_t>(remote_port)); |
206 | 206 |
207 // Enable raw event and stats logging. | 207 // Enable raw event and stats logging. |
208 // Running transport on the main thread. | 208 // Running transport on the main thread. |
209 scoped_refptr<media::cast::CastEnvironment> cast_environment( | 209 scoped_refptr<media::cast::CastEnvironment> cast_environment( |
210 new media::cast::CastEnvironment( | 210 new media::cast::CastEnvironment( |
211 make_scoped_ptr<base::TickClock>(new base::DefaultTickClock()), | 211 make_scoped_ptr<base::TickClock>(new base::DefaultTickClock()), |
212 io_message_loop.task_runner(), | 212 io_message_loop.task_runner(), |
213 audio_thread.task_runner(), | 213 audio_thread.task_runner(), |
214 video_thread.task_runner())); | 214 video_thread.task_runner())); |
215 | 215 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 base::Unretained(cast_sender.get()), | 325 base::Unretained(cast_sender.get()), |
326 audio_config, | 326 audio_config, |
327 base::Bind(&QuitLoopOnInitializationResult))); | 327 base::Bind(&QuitLoopOnInitializationResult))); |
328 io_message_loop.Run(); // Wait for audio initialization. | 328 io_message_loop.Run(); // Wait for audio initialization. |
329 | 329 |
330 fake_media_source->Start(cast_sender->audio_frame_input(), | 330 fake_media_source->Start(cast_sender->audio_frame_input(), |
331 cast_sender->video_frame_input()); | 331 cast_sender->video_frame_input()); |
332 io_message_loop.Run(); | 332 io_message_loop.Run(); |
333 return 0; | 333 return 0; |
334 } | 334 } |
OLD | NEW |