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

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

Issue 1378513003: Change 'mute' parameter of MediaChannel::SetAudioSend()/SetVideoSend() to 'enable'. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 2 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
« no previous file with comments | « talk/media/base/mediachannel.h ('k') | talk/media/webrtc/webrtcvideoengine2.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 cricket::VideoFormat( 1636 cricket::VideoFormat(
1637 640, 480, 1637 640, 480,
1638 cricket::VideoFormat::FpsToInterval(30), 1638 cricket::VideoFormat::FpsToInterval(30),
1639 cricket::FOURCC_I420)); 1639 cricket::FOURCC_I420));
1640 EXPECT_TRUE(channel_->SetCapturer(kSsrc, &video_capturer)); 1640 EXPECT_TRUE(channel_->SetCapturer(kSsrc, &video_capturer));
1641 EXPECT_TRUE(SetSend(true)); 1641 EXPECT_TRUE(SetSend(true));
1642 EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_)); 1642 EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
1643 EXPECT_EQ(0, renderer_.num_rendered_frames()); 1643 EXPECT_EQ(0, renderer_.num_rendered_frames());
1644 // Mute the channel and expect black output frame. 1644 // Mute the channel and expect black output frame.
1645 int frame_count = 0; 1645 int frame_count = 0;
1646 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr)); 1646 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, false, nullptr));
1647 EXPECT_TRUE(video_capturer.CaptureFrame()); 1647 EXPECT_TRUE(video_capturer.CaptureFrame());
1648 ++frame_count; 1648 ++frame_count;
1649 EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout); 1649 EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout);
1650 EXPECT_TRUE(renderer_.black_frame()); 1650 EXPECT_TRUE(renderer_.black_frame());
1651 // Unmute the channel and expect non-black output frame. 1651 // Unmute the channel and expect non-black output frame.
1652 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, false, nullptr)); 1652 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr));
1653 EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30)); 1653 EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30));
1654 EXPECT_TRUE(video_capturer.CaptureFrame()); 1654 EXPECT_TRUE(video_capturer.CaptureFrame());
1655 ++frame_count; 1655 ++frame_count;
1656 EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout); 1656 EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout);
1657 EXPECT_FALSE(renderer_.black_frame()); 1657 EXPECT_FALSE(renderer_.black_frame());
1658 // Test that we can also Mute using the correct send stream SSRC. 1658 // Test that we can also Mute using the correct send stream SSRC.
1659 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr)); 1659 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, false, nullptr));
1660 EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30)); 1660 EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30));
1661 EXPECT_TRUE(video_capturer.CaptureFrame()); 1661 EXPECT_TRUE(video_capturer.CaptureFrame());
1662 ++frame_count; 1662 ++frame_count;
1663 EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout); 1663 EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout);
1664 EXPECT_TRUE(renderer_.black_frame()); 1664 EXPECT_TRUE(renderer_.black_frame());
1665 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, false, nullptr)); 1665 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr));
1666 EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30)); 1666 EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30));
1667 EXPECT_TRUE(video_capturer.CaptureFrame()); 1667 EXPECT_TRUE(video_capturer.CaptureFrame());
1668 ++frame_count; 1668 ++frame_count;
1669 EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout); 1669 EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout);
1670 EXPECT_FALSE(renderer_.black_frame()); 1670 EXPECT_FALSE(renderer_.black_frame());
1671 // Test that muting an existing stream succeeds even if it's muted. 1671 // Test that muting an existing stream succeeds even if it's muted.
1672 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, false, nullptr));
1673 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, false, nullptr));
1674 // Test that unmuting an existing stream succeeds even if it's not muted.
1672 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr)); 1675 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr));
1673 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr)); 1676 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr));
1674 // Test that unmuting an existing stream succeeds even if it's not muted.
1675 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, false, nullptr));
1676 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, false, nullptr));
1677 // Test that muting an invalid stream fails. 1677 // Test that muting an invalid stream fails.
1678 EXPECT_FALSE(channel_->SetVideoSend(kSsrc+1, true, nullptr)); 1678 EXPECT_FALSE(channel_->SetVideoSend(kSsrc+1, false, nullptr));
1679 EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL)); 1679 EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL));
1680 } 1680 }
1681 1681
1682 // Test that multiple send streams can be created and deleted properly. 1682 // Test that multiple send streams can be created and deleted properly.
1683 void MultipleSendStreams() { 1683 void MultipleSendStreams() {
1684 // Remove stream added in Setup. I.e. remove stream corresponding to default 1684 // Remove stream added in Setup. I.e. remove stream corresponding to default
1685 // channel. 1685 // channel.
1686 EXPECT_TRUE(channel_->RemoveSendStream(kSsrc)); 1686 EXPECT_TRUE(channel_->RemoveSendStream(kSsrc));
1687 const unsigned int kSsrcsSize = sizeof(kSsrcs4)/sizeof(kSsrcs4[0]); 1687 const unsigned int kSsrcsSize = sizeof(kSsrcs4)/sizeof(kSsrcs4[0]);
1688 for (unsigned int i = 0; i < kSsrcsSize; ++i) { 1688 for (unsigned int i = 0; i < kSsrcsSize; ++i) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 rtc::scoped_ptr<C> channel_; 1807 rtc::scoped_ptr<C> channel_;
1808 cricket::FakeNetworkInterface network_interface_; 1808 cricket::FakeNetworkInterface network_interface_;
1809 cricket::FakeVideoRenderer renderer_; 1809 cricket::FakeVideoRenderer renderer_;
1810 cricket::VideoMediaChannel::Error media_error_; 1810 cricket::VideoMediaChannel::Error media_error_;
1811 1811
1812 // Used by test cases where 2 streams are run on the same channel. 1812 // Used by test cases where 2 streams are run on the same channel.
1813 cricket::FakeVideoRenderer renderer2_; 1813 cricket::FakeVideoRenderer renderer2_;
1814 }; 1814 };
1815 1815
1816 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT 1816 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT
OLDNEW
« no previous file with comments | « talk/media/base/mediachannel.h ('k') | talk/media/webrtc/webrtcvideoengine2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698