Enable SendAndReceive tests.

Also fixes a crash in ::SetCapturer which wasn't exposed by tests
before.

BUG=1788
R=wu@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/18019005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6765 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2014-07-23 15:44:48 +00:00
parent f24c4a3b8d
commit 9359cb3e75
2 changed files with 51 additions and 31 deletions

View File

@ -1402,18 +1402,20 @@ bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetCapturer(
{
talk_base::CritScope cs(&lock_);
if (capturer == NULL && stream_ != NULL) {
LOG(LS_VERBOSE) << "Disabling capturer, sending black frame.";
webrtc::I420VideoFrame black_frame;
if (capturer == NULL) {
if (stream_ != NULL) {
LOG(LS_VERBOSE) << "Disabling capturer, sending black frame.";
webrtc::I420VideoFrame black_frame;
int width = format_.width;
int height = format_.height;
int half_width = (width + 1) / 2;
black_frame.CreateEmptyFrame(
width, height, width, half_width, half_width);
SetWebRtcFrameToBlack(&black_frame);
SetDimensions(width, height);
stream_->Input()->SwapFrame(&black_frame);
int width = format_.width;
int height = format_.height;
int half_width = (width + 1) / 2;
black_frame.CreateEmptyFrame(
width, height, width, half_width, half_width);
SetWebRtcFrameToBlack(&black_frame);
SetDimensions(width, height);
stream_->Input()->SwapFrame(&black_frame);
}
capturer_ = NULL;
return true;

View File

@ -542,6 +542,18 @@ WEBRTC_BASE_TEST(SetSendStreamFormat0x0);
// TODO(zhurunz): Fix the flakey test.
WEBRTC_DISABLED_BASE_TEST(SetSendStreamFormat);
TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8Vga) {
SendAndReceive(cricket::VideoCodec(100, "VP8", 640, 400, 30, 0));
}
TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8Qvga) {
SendAndReceive(cricket::VideoCodec(100, "VP8", 320, 200, 30, 0));
}
TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8SvcQqvga) {
SendAndReceive(cricket::VideoCodec(100, "VP8", 160, 100, 30, 0));
}
TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsSendAndReceive) {
Base::TwoStreamsSendAndReceive(kVp8Codec);
}
@ -550,6 +562,32 @@ TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsReUseFirstStream) {
Base::TwoStreamsReUseFirstStream(kVp8Codec);
}
WEBRTC_BASE_TEST(SendManyResizeOnce);
// TODO(pbos): Enable and figure out why this fails (or should work).
TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_SendVp8HdAndReceiveAdaptedVp8Vga) {
EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL));
EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
channel_->UpdateAspectRatio(1280, 720);
video_capturer_.reset(new cricket::FakeVideoCapturer);
const std::vector<cricket::VideoFormat>* formats =
video_capturer_->GetSupportedFormats();
cricket::VideoFormat capture_format_hd = (*formats)[0];
EXPECT_EQ(cricket::CS_RUNNING, video_capturer_->Start(capture_format_hd));
EXPECT_TRUE(channel_->SetCapturer(kSsrc, video_capturer_.get()));
// Capture format HD -> adapt (OnOutputFormatRequest VGA) -> VGA.
cricket::VideoCodec codec(100, "VP8", 1280, 720, 30, 0);
EXPECT_TRUE(SetOneCodec(codec));
codec.width /= 2;
codec.height /= 2;
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(channel_->SetRender(true));
EXPECT_EQ(0, renderer_.num_rendered_frames());
EXPECT_TRUE(SendFrame());
EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout);
}
class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test {
public:
virtual void SetUp() OVERRIDE {
@ -1494,26 +1532,6 @@ TEST_F(WebRtcVideoChannel2Test, SetSend) {
<< "Send stream created after SetSend(true) not sending initially.";
}
TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveVp8Vga) {
FAIL() << "Not implemented."; // TODO(pbos): Implement.
}
TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveVp8Qvga) {
FAIL() << "Not implemented."; // TODO(pbos): Implement.
}
TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveH264SvcQqvga) {
FAIL() << "Not implemented."; // TODO(pbos): Implement.
}
TEST_F(WebRtcVideoChannel2Test, DISABLED_SendManyResizeOnce) {
FAIL() << "Not implemented."; // TODO(pbos): Implement.
}
TEST_F(WebRtcVideoChannel2Test, DISABLED_SendVp8HdAndReceiveAdaptedVp8Vga) {
FAIL() << "Not implemented."; // TODO(pbos): Implement.
}
TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetDscpOptions) {
FAIL() << "Not implemented."; // TODO(pbos): Implement.
}