Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1011)

Side by Side Diff: talk/media/base/videoengine_unittest.h

Issue 1658533003: Remove unimplemented VideoChannel code. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // Normal setup; note that we set the SSRC explicitly to ensure that 581 // Normal setup; note that we set the SSRC explicitly to ensure that
582 // it will come first in the senders map. 582 // it will come first in the senders map.
583 EXPECT_TRUE(SetOneCodec(DefaultCodec())); 583 EXPECT_TRUE(SetOneCodec(DefaultCodec()));
584 cricket::VideoSendParameters parameters; 584 cricket::VideoSendParameters parameters;
585 parameters.codecs.push_back(DefaultCodec()); 585 parameters.codecs.push_back(DefaultCodec());
586 parameters.options.conference_mode = rtc::Optional<bool>(true); 586 parameters.options.conference_mode = rtc::Optional<bool>(true);
587 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 587 EXPECT_TRUE(channel_->SetSendParameters(parameters));
588 EXPECT_TRUE(channel_->AddRecvStream( 588 EXPECT_TRUE(channel_->AddRecvStream(
589 cricket::StreamParams::CreateLegacy(kSsrc))); 589 cricket::StreamParams::CreateLegacy(kSsrc)));
590 EXPECT_TRUE(channel_->SetRenderer(kSsrc, &renderer_)); 590 EXPECT_TRUE(channel_->SetRenderer(kSsrc, &renderer_));
591 channel_->UpdateAspectRatio(640, 400);
592 EXPECT_TRUE(SetSend(true)); 591 EXPECT_TRUE(SetSend(true));
593 EXPECT_TRUE(SendFrame()); 592 EXPECT_TRUE(SendFrame());
594 EXPECT_TRUE_WAIT(NumRtpPackets() > 0, kTimeout); 593 EXPECT_TRUE_WAIT(NumRtpPackets() > 0, kTimeout);
595 EXPECT_FRAME_WAIT(1, DefaultCodec().width, DefaultCodec().height, kTimeout); 594 EXPECT_FRAME_WAIT(1, DefaultCodec().width, DefaultCodec().height, kTimeout);
596 595
597 // Add an additional capturer, and hook up a renderer to receive it. 596 // Add an additional capturer, and hook up a renderer to receive it.
598 cricket::FakeVideoRenderer renderer2; 597 cricket::FakeVideoRenderer renderer2;
599 rtc::scoped_ptr<cricket::FakeVideoCapturer> capturer( 598 rtc::scoped_ptr<cricket::FakeVideoCapturer> capturer(
600 CreateFakeVideoCapturer()); 599 CreateFakeVideoCapturer());
601 capturer->SetScreencast(true); 600 capturer->SetScreencast(true);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 // Wait 30ms to guarantee the engine does not drop the frame. 752 // Wait 30ms to guarantee the engine does not drop the frame.
754 EXPECT_TRUE(WaitAndSendFrame(30)); 753 EXPECT_TRUE(WaitAndSendFrame(30));
755 EXPECT_TRUE_WAIT(NumRtpPackets() > rtp_packets, kTimeout); 754 EXPECT_TRUE_WAIT(NumRtpPackets() > rtp_packets, kTimeout);
756 755
757 last_packet = NumRtpPackets() - 1; 756 last_packet = NumRtpPackets() - 1;
758 p.reset(GetRtpPacket(static_cast<int>(last_packet))); 757 p.reset(GetRtpPacket(static_cast<int>(last_packet)));
759 ParseRtpPacket(p.get(), NULL, NULL, NULL, NULL, &ssrc, NULL); 758 ParseRtpPacket(p.get(), NULL, NULL, NULL, NULL, &ssrc, NULL);
760 EXPECT_EQ(789u, ssrc); 759 EXPECT_EQ(789u, ssrc);
761 } 760 }
762 761
763 // Test that no frames are rendered after the receive stream have been
764 // removed.
765 void AddRemoveRecvStreamAndRender() {
766 cricket::FakeVideoRenderer renderer1;
767 EXPECT_TRUE(SetDefaultCodec());
768 EXPECT_TRUE(SetSend(true));
769 EXPECT_TRUE(channel_->AddRecvStream(
770 cricket::StreamParams::CreateLegacy(kSsrc)));
771 EXPECT_TRUE(channel_->SetRenderer(kSsrc, &renderer1));
772
773 EXPECT_TRUE(SendFrame());
774 EXPECT_FRAME_ON_RENDERER_WAIT(
775 renderer1, 1, DefaultCodec().width, DefaultCodec().height, kTimeout);
776 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc));
777 // Send three more frames. This is to avoid that the test might be flaky
778 // due to frame dropping.
779 for (size_t i = 0; i < 3; ++i)
780 EXPECT_TRUE(WaitAndSendFrame(100));
781
782 // Test that no more frames have been rendered.
783 EXPECT_EQ(1, renderer1.num_rendered_frames());
784
785 // Re-add the stream again and make sure it renders.
786 EXPECT_TRUE(channel_->AddRecvStream(
787 cricket::StreamParams::CreateLegacy(kSsrc)));
788 // Force the next frame to be a key frame to make the receiving
789 // decoder happy.
790 EXPECT_TRUE(channel_->SendIntraFrame());
791
792 EXPECT_TRUE(channel_->SetRenderer(kSsrc, &renderer1));
793 EXPECT_TRUE(SendFrame());
794 // Because the default channel is used, RemoveRecvStream above is not going
795 // to delete the channel. As a result the engine will continue to receive
796 // and decode the 3 frames sent above. So it is possible we will receive
797 // some (e.g. 1) of these 3 frames after the renderer is set again.
798 EXPECT_GT_FRAME_ON_RENDERER_WAIT(
799 renderer1, 2, DefaultCodec().width, DefaultCodec().height, kTimeout);
800 // Detach |renderer1| before exit as there might be frames come late.
801 EXPECT_TRUE(channel_->SetRenderer(kSsrc, NULL));
802 }
803
804 // Tests the behavior of incoming streams in a conference scenario. 762 // Tests the behavior of incoming streams in a conference scenario.
805 void SimulateConference() { 763 void SimulateConference() {
806 cricket::FakeVideoRenderer renderer1, renderer2; 764 cricket::FakeVideoRenderer renderer1, renderer2;
807 EXPECT_TRUE(SetDefaultCodec()); 765 EXPECT_TRUE(SetDefaultCodec());
808 cricket::VideoSendParameters parameters; 766 cricket::VideoSendParameters parameters;
809 parameters.codecs.push_back(DefaultCodec()); 767 parameters.codecs.push_back(DefaultCodec());
810 parameters.options.conference_mode = rtc::Optional<bool>(true); 768 parameters.options.conference_mode = rtc::Optional<bool>(true);
811 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 769 EXPECT_TRUE(channel_->SetSendParameters(parameters));
812 EXPECT_TRUE(SetSend(true)); 770 EXPECT_TRUE(SetSend(true));
813 EXPECT_TRUE(channel_->AddRecvStream( 771 EXPECT_TRUE(channel_->AddRecvStream(
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 rtc::scoped_ptr<C> channel_; 1279 rtc::scoped_ptr<C> channel_;
1322 cricket::FakeNetworkInterface network_interface_; 1280 cricket::FakeNetworkInterface network_interface_;
1323 cricket::FakeVideoRenderer renderer_; 1281 cricket::FakeVideoRenderer renderer_;
1324 cricket::VideoMediaChannel::Error media_error_; 1282 cricket::VideoMediaChannel::Error media_error_;
1325 1283
1326 // Used by test cases where 2 streams are run on the same channel. 1284 // Used by test cases where 2 streams are run on the same channel.
1327 cricket::FakeVideoRenderer renderer2_; 1285 cricket::FakeVideoRenderer renderer2_;
1328 }; 1286 };
1329 1287
1330 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT 1288 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698