OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 virtual cricket::StreamParams DefaultSendStreamParams() { | 458 virtual cricket::StreamParams DefaultSendStreamParams() { |
459 return cricket::StreamParams::CreateLegacy(kSsrc); | 459 return cricket::StreamParams::CreateLegacy(kSsrc); |
460 } | 460 } |
461 | 461 |
462 virtual void SetUp() { | 462 virtual void SetUp() { |
463 cricket::Device device("test", "device"); | 463 cricket::Device device("test", "device"); |
464 engine_.Init(); | 464 engine_.Init(); |
465 channel_.reset( | 465 channel_.reset( |
466 engine_.CreateChannel(call_.get(), cricket::VideoOptions())); | 466 engine_.CreateChannel(call_.get(), cricket::VideoOptions())); |
467 EXPECT_TRUE(channel_.get() != NULL); | 467 EXPECT_TRUE(channel_.get() != NULL); |
468 ConnectVideoChannelError(); | |
469 network_interface_.SetDestination(channel_.get()); | 468 network_interface_.SetDestination(channel_.get()); |
470 channel_->SetInterface(&network_interface_); | 469 channel_->SetInterface(&network_interface_); |
471 media_error_ = cricket::VideoMediaChannel::ERROR_NONE; | 470 media_error_ = cricket::VideoMediaChannel::ERROR_NONE; |
472 cricket::VideoRecvParameters parameters; | 471 cricket::VideoRecvParameters parameters; |
473 parameters.codecs = engine_.codecs(); | 472 parameters.codecs = engine_.codecs(); |
474 channel_->SetRecvParameters(parameters); | 473 channel_->SetRecvParameters(parameters); |
475 EXPECT_TRUE(channel_->AddSendStream(DefaultSendStreamParams())); | 474 EXPECT_TRUE(channel_->AddSendStream(DefaultSendStreamParams())); |
476 video_capturer_.reset(CreateFakeVideoCapturer()); | 475 video_capturer_.reset(CreateFakeVideoCapturer()); |
477 cricket::VideoFormat format(640, 480, | 476 cricket::VideoFormat format(640, 480, |
478 cricket::VideoFormat::FpsToInterval(30), | 477 cricket::VideoFormat::FpsToInterval(30), |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 cricket::VideoFormat format(640, 480, | 512 cricket::VideoFormat format(640, 480, |
514 cricket::VideoFormat::FpsToInterval(30), | 513 cricket::VideoFormat::FpsToInterval(30), |
515 cricket::FOURCC_I420); | 514 cricket::FOURCC_I420); |
516 EXPECT_EQ(cricket::CS_RUNNING, video_capturer_2_->Start(format)); | 515 EXPECT_EQ(cricket::CS_RUNNING, video_capturer_2_->Start(format)); |
517 | 516 |
518 EXPECT_TRUE(channel_->SetCapturer(kSsrc + 2, video_capturer_2_.get())); | 517 EXPECT_TRUE(channel_->SetCapturer(kSsrc + 2, video_capturer_2_.get())); |
519 } | 518 } |
520 virtual void TearDown() { | 519 virtual void TearDown() { |
521 channel_.reset(); | 520 channel_.reset(); |
522 } | 521 } |
523 void ConnectVideoChannelError() { | |
524 channel_->SignalMediaError.connect(this, | |
525 &VideoMediaChannelTest<E, C>::OnVideoChannelError); | |
526 } | |
527 bool SetDefaultCodec() { | 522 bool SetDefaultCodec() { |
528 return SetOneCodec(DefaultCodec()); | 523 return SetOneCodec(DefaultCodec()); |
529 } | 524 } |
530 | 525 |
531 bool SetOneCodec(int pt, const char* name, int w, int h, int fr) { | 526 bool SetOneCodec(int pt, const char* name, int w, int h, int fr) { |
532 return SetOneCodec(cricket::VideoCodec(pt, name, w, h, fr, 0)); | 527 return SetOneCodec(cricket::VideoCodec(pt, name, w, h, fr, 0)); |
533 } | 528 } |
534 bool SetOneCodec(const cricket::VideoCodec& codec) { | 529 bool SetOneCodec(const cricket::VideoCodec& codec) { |
535 cricket::VideoFormat capture_format(codec.width, codec.height, | 530 cricket::VideoFormat capture_format(codec.width, codec.height, |
536 cricket::VideoFormat::FpsToInterval(codec.framerate), | 531 cricket::VideoFormat::FpsToInterval(codec.framerate), |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1807 rtc::scoped_ptr<C> channel_; | 1802 rtc::scoped_ptr<C> channel_; |
1808 cricket::FakeNetworkInterface network_interface_; | 1803 cricket::FakeNetworkInterface network_interface_; |
1809 cricket::FakeVideoRenderer renderer_; | 1804 cricket::FakeVideoRenderer renderer_; |
1810 cricket::VideoMediaChannel::Error media_error_; | 1805 cricket::VideoMediaChannel::Error media_error_; |
1811 | 1806 |
1812 // Used by test cases where 2 streams are run on the same channel. | 1807 // Used by test cases where 2 streams are run on the same channel. |
1813 cricket::FakeVideoRenderer renderer2_; | 1808 cricket::FakeVideoRenderer renderer2_; |
1814 }; | 1809 }; |
1815 | 1810 |
1816 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT | 1811 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT |
OLD | NEW |