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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 }; | 290 }; |
291 | 291 |
292 } // namespace cast | 292 } // namespace cast |
293 } // namespace media | 293 } // namespace media |
294 | 294 |
295 namespace { | 295 namespace { |
296 void UpdateCastTransportStatus( | 296 void UpdateCastTransportStatus( |
297 media::cast::transport::CastTransportStatus status) {} | 297 media::cast::transport::CastTransportStatus status) {} |
298 | 298 |
299 void InitializationResult(media::cast::CastInitializationStatus result) { | 299 void InitializationResult(media::cast::CastInitializationStatus result) { |
300 CHECK_EQ(result, media::cast::STATUS_INITIALIZED); | 300 bool end_result = result == media::cast::STATUS_AUDIO_INITIALIZED || |
301 result == media::cast::STATUS_VIDEO_INITIALIZED; | |
302 CHECK(end_result); | |
Ami GONE FROM CHROMIUM
2014/02/13 18:02:14
ditto
mikhal1
2014/02/14 18:03:16
Probably an overkill here, as it's just a test app
| |
301 VLOG(1) << "Cast Sender initialized"; | 303 VLOG(1) << "Cast Sender initialized"; |
Ami GONE FROM CHROMIUM
2014/02/13 18:02:14
a bit of an overstatement now
mikhal1
2014/02/14 18:03:16
Done.
| |
302 } | 304 } |
303 | 305 |
304 net::IPEndPoint CreateUDPAddress(std::string ip_str, int port) { | 306 net::IPEndPoint CreateUDPAddress(std::string ip_str, int port) { |
305 net::IPAddressNumber ip_number; | 307 net::IPAddressNumber ip_number; |
306 CHECK(net::ParseIPLiteralToNumber(ip_str, &ip_number)); | 308 CHECK(net::ParseIPLiteralToNumber(ip_str, &ip_number)); |
307 return net::IPEndPoint(ip_number, port); | 309 return net::IPEndPoint(ip_number, port); |
308 } | 310 } |
309 | 311 |
310 } // namespace | 312 } // namespace |
311 | 313 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
358 audio_thread.message_loop_proxy(), | 360 audio_thread.message_loop_proxy(), |
359 NULL, | 361 NULL, |
360 video_thread.message_loop_proxy(), | 362 video_thread.message_loop_proxy(), |
361 NULL, | 363 NULL, |
362 io_message_loop.message_loop_proxy(), | 364 io_message_loop.message_loop_proxy(), |
363 media::cast::GetDefaultCastSenderLoggingConfig())); | 365 media::cast::GetDefaultCastSenderLoggingConfig())); |
364 | 366 |
365 scoped_ptr<media::cast::CastSender> cast_sender( | 367 scoped_ptr<media::cast::CastSender> cast_sender( |
366 media::cast::CastSender::CreateCastSender( | 368 media::cast::CastSender::CreateCastSender( |
367 cast_environment, | 369 cast_environment, |
368 &audio_config, | |
369 &video_config, | |
370 NULL, // gpu_factories. | |
371 base::Bind(&InitializationResult), | 370 base::Bind(&InitializationResult), |
372 transport_sender.get())); | 371 transport_sender.get())); |
373 | 372 |
373 cast_sender->InitializeVideo(video_config, NULL); | |
374 cast_sender->InitializeAudio(audio_config); | |
375 | |
374 transport_sender->SetPacketReceiver(cast_sender->packet_receiver()); | 376 transport_sender->SetPacketReceiver(cast_sender->packet_receiver()); |
375 | 377 |
376 media::cast::FrameInput* frame_input = cast_sender->frame_input(); | 378 media::cast::FrameInput* frame_input = cast_sender->frame_input(); |
377 scoped_ptr<media::cast::SendProcess> send_process( | 379 scoped_ptr<media::cast::SendProcess> send_process( |
378 new media::cast::SendProcess(test_thread.message_loop_proxy(), | 380 new media::cast::SendProcess(test_thread.message_loop_proxy(), |
379 cast_environment->Clock(), | 381 cast_environment->Clock(), |
380 video_config, | 382 video_config, |
381 frame_input)); | 383 frame_input)); |
382 | 384 |
383 test_thread.message_loop_proxy()->PostTask( | 385 test_thread.message_loop_proxy()->PostTask( |
384 FROM_HERE, | 386 FROM_HERE, |
385 base::Bind(&media::cast::SendProcess::SendFrame, | 387 base::Bind(&media::cast::SendProcess::SendFrame, |
386 base::Unretained(send_process.get()))); | 388 base::Unretained(send_process.get()))); |
387 | 389 |
388 io_message_loop.Run(); | 390 io_message_loop.Run(); |
389 return 0; | 391 return 0; |
390 } | 392 } |
OLD | NEW |