blob: a8e2da3aa677f5d89feb0b600c470baaf00fa437 [file] [log] [blame]
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +00001/*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "base_primitives.h"
12
13#include "vie_autotest.h"
14#include "vie_autotest_defines.h"
andrew@webrtc.org5f6856f2012-10-30 21:58:00 +000015#include "webrtc/modules/video_capture/include/video_capture_factory.h"
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000016
17void TestI420CallSetup(webrtc::ViECodec* codec_interface,
18 webrtc::VideoEngine* video_engine,
19 webrtc::ViEBase* base_interface,
20 webrtc::ViENetwork* network_interface,
21 int video_channel,
22 const char* device_name) {
23 webrtc::VideoCodec video_codec;
24 memset(&video_codec, 0, sizeof(webrtc::VideoCodec));
25
26 // Set up the codec interface with all known receive codecs and with
27 // I420 as the send codec.
28 for (int i = 0; i < codec_interface->NumberOfCodecs(); i++) {
29 EXPECT_EQ(0, codec_interface->GetCodec(i, video_codec));
30
31 // Try to keep the test frame size small when I420.
32 if (video_codec.codecType == webrtc::kVideoCodecI420) {
33 video_codec.width = 176;
34 video_codec.height = 144;
35 EXPECT_EQ(0, codec_interface->SetSendCodec(video_channel, video_codec));
36 }
37
38 EXPECT_EQ(0, codec_interface->SetReceiveCodec(video_channel, video_codec));
39 }
40
41 // Verify that we really found the I420 codec.
42 EXPECT_EQ(0, codec_interface->GetSendCodec(video_channel, video_codec));
43 EXPECT_EQ(webrtc::kVideoCodecI420, video_codec.codecType);
44
45 // Set up senders and receivers.
46 char version[1024] = "";
47 EXPECT_EQ(0, base_interface->GetVersion(version));
48 ViETest::Log("\nUsing WebRTC Video Engine version: %s", version);
49
50 const char *ipAddress = "127.0.0.1";
51 WebRtc_UWord16 rtpPortListen = 6100;
52 WebRtc_UWord16 rtpPortSend = 6100;
53 EXPECT_EQ(0, network_interface->SetLocalReceiver(video_channel,
54 rtpPortListen));
55 EXPECT_EQ(0, base_interface->StartReceive(video_channel));
56 EXPECT_EQ(0, network_interface->SetSendDestination(video_channel, ipAddress,
57 rtpPortSend));
58 EXPECT_EQ(0, base_interface->StartSend(video_channel));
59
60 // Call started.
61 ViETest::Log("Call started");
62
63 AutoTestSleep(KAutoTestSleepTimeMs);
64
65 // Done.
66 EXPECT_EQ(0, base_interface->StopSend(video_channel));
67}