1 /* 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 // 12 // vie_autotest.cc 13 // 14 15 #include "webrtc/video_engine/test/auto_test/interface/vie_autotest.h" 16 17 #include <stdio.h> 18 19 #include "webrtc/engine_configurations.h" 20 #include "webrtc/modules/video_render/include/video_render.h" 21 #include "webrtc/test/testsupport/fileutils.h" 22 #include "webrtc/video_engine/test/auto_test/interface/vie_autotest_defines.h" 23 #include "webrtc/video_engine/test/auto_test/primitives/general_primitives.h" 24 #include "webrtc/video_engine/test/libvietest/include/tb_capture_device.h" 25 #include "webrtc/video_engine/test/libvietest/include/tb_interfaces.h" 26 #include "webrtc/video_engine/test/libvietest/include/tb_video_channel.h" 27 28 DEFINE_bool(include_timing_dependent_tests, true, 29 "If true, we will include tests / parts of tests that are known " 30 "to break in slow execution environments (such as valgrind)."); 31 32 // ViETest implementation 33 FILE* ViETest::log_file_ = NULL; 34 char* ViETest::log_str_ = NULL; 35 36 std::string ViETest::GetResultOutputPath() { 37 return webrtc::test::OutputPath(); 38 } 39 40 // ViEAutoTest implementation 41 ViEAutoTest::ViEAutoTest(void* window1, void* window2) : 42 _window1(window1), 43 _window2(window2), 44 _renderType(webrtc::kRenderDefault), 45 _vrm1(webrtc::VideoRender::CreateVideoRender( 46 4561, window1, false, _renderType)), 47 _vrm2(webrtc::VideoRender::CreateVideoRender( 48 4562, window2, false, _renderType)) 49 { 50 assert(_vrm1); 51 assert(_vrm2); 52 } 53 54 ViEAutoTest::~ViEAutoTest() 55 { 56 webrtc::VideoRender::DestroyVideoRender(_vrm1); 57 _vrm1 = NULL; 58 webrtc::VideoRender::DestroyVideoRender(_vrm2); 59 _vrm2 = NULL; 60 } 61 62 void ViEAutoTest::ViEStandardTest() 63 { 64 ViEBaseStandardTest(); 65 ViECaptureStandardTest(); 66 ViECodecStandardTest(); 67 ViEImageProcessStandardTest(); 68 ViERenderStandardTest(); 69 ViERtpRtcpStandardTest(); 70 } 71 72 void ViEAutoTest::ViEExtendedTest() 73 { 74 ViEBaseExtendedTest(); 75 ViECaptureExtendedTest(); 76 ViECodecExtendedTest(); 77 ViEImageProcessExtendedTest(); 78 ViERenderExtendedTest(); 79 ViERtpRtcpExtendedTest(); 80 } 81 82 void ViEAutoTest::ViEAPITest() 83 { 84 ViEBaseAPITest(); 85 ViECaptureAPITest(); 86 ViECodecAPITest(); 87 ViEImageProcessAPITest(); 88 ViERenderAPITest(); 89 ViERtpRtcpAPITest(); 90 } 91 92 void ViEAutoTest::PrintVideoCodec(const webrtc::VideoCodec videoCodec) 93 { 94 ViETest::Log("Video Codec Information:"); 95 96 switch (videoCodec.codecType) 97 { 98 case webrtc::kVideoCodecVP8: 99 ViETest::Log("\tcodecType: VP8"); 100 break; 101 case webrtc::kVideoCodecI420: 102 ViETest::Log("\tcodecType: I420"); 103 break; 104 case webrtc::kVideoCodecH264: 105 ViETest::Log("\tcodecType: H264"); 106 break; 107 case webrtc::kVideoCodecRED: 108 ViETest::Log("\tcodecType: RED"); 109 break; 110 case webrtc::kVideoCodecULPFEC: 111 ViETest::Log("\tcodecType: ULPFEC"); 112 break; 113 case webrtc::kVideoCodecGeneric: 114 ViETest::Log("\tcodecType: GENERIC"); 115 break; 116 case webrtc::kVideoCodecUnknown: 117 ViETest::Log("\tcodecType: UNKNOWN"); 118 break; 119 } 120 121 ViETest::Log("\theight: %u", videoCodec.height); 122 ViETest::Log("\tmaxBitrate: %u", videoCodec.maxBitrate); 123 ViETest::Log("\tmaxFramerate: %u", videoCodec.maxFramerate); 124 ViETest::Log("\tminBitrate: %u", videoCodec.minBitrate); 125 ViETest::Log("\tplName: %s", videoCodec.plName); 126 ViETest::Log("\tplType: %u", videoCodec.plType); 127 ViETest::Log("\tstartBitrate: %u", videoCodec.startBitrate); 128 ViETest::Log("\twidth: %u", videoCodec.width); 129 ViETest::Log(""); 130 } 131 132 void ViEAutoTest::PrintAudioCodec(const webrtc::CodecInst audioCodec) 133 { 134 ViETest::Log("Audio Codec Information:"); 135 ViETest::Log("\tchannels: %u", audioCodec.channels); 136 ViETest::Log("\t: %u", audioCodec.pacsize); 137 ViETest::Log("\t: %u", audioCodec.plfreq); 138 ViETest::Log("\t: %s", audioCodec.plname); 139 ViETest::Log("\t: %u", audioCodec.pltype); 140 ViETest::Log("\t: %u", audioCodec.rate); 141 ViETest::Log(""); 142 } 143 144 void ViEAutoTest::RenderCaptureDeviceAndOutputStream( 145 TbInterfaces* video_engine, 146 TbVideoChannel* video_channel, 147 TbCaptureDevice* capture_device) { 148 RenderInWindow( 149 video_engine->render, capture_device->captureId, _window1, 0); 150 RenderInWindow( 151 video_engine->render, video_channel->videoChannel, _window2, 1); 152 } 153