Home | History | Annotate | Download | only in source
      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::kVideoCodecRED:
    105             ViETest::Log("\tcodecType: RED");
    106             break;
    107         case webrtc::kVideoCodecULPFEC:
    108             ViETest::Log("\tcodecType: ULPFEC");
    109             break;
    110         case webrtc::kVideoCodecGeneric:
    111             ViETest::Log("\tcodecType: GENERIC");
    112             break;
    113         case webrtc::kVideoCodecUnknown:
    114             ViETest::Log("\tcodecType: UNKNOWN");
    115             break;
    116     }
    117 
    118     ViETest::Log("\theight: %u", videoCodec.height);
    119     ViETest::Log("\tmaxBitrate: %u", videoCodec.maxBitrate);
    120     ViETest::Log("\tmaxFramerate: %u", videoCodec.maxFramerate);
    121     ViETest::Log("\tminBitrate: %u", videoCodec.minBitrate);
    122     ViETest::Log("\tplName: %s", videoCodec.plName);
    123     ViETest::Log("\tplType: %u", videoCodec.plType);
    124     ViETest::Log("\tstartBitrate: %u", videoCodec.startBitrate);
    125     ViETest::Log("\twidth: %u", videoCodec.width);
    126     ViETest::Log("");
    127 }
    128 
    129 void ViEAutoTest::PrintAudioCodec(const webrtc::CodecInst audioCodec)
    130 {
    131     ViETest::Log("Audio Codec Information:");
    132     ViETest::Log("\tchannels: %u", audioCodec.channels);
    133     ViETest::Log("\t: %u", audioCodec.pacsize);
    134     ViETest::Log("\t: %u", audioCodec.plfreq);
    135     ViETest::Log("\t: %s", audioCodec.plname);
    136     ViETest::Log("\t: %u", audioCodec.pltype);
    137     ViETest::Log("\t: %u", audioCodec.rate);
    138     ViETest::Log("");
    139 }
    140 
    141 void ViEAutoTest::RenderCaptureDeviceAndOutputStream(
    142     TbInterfaces* video_engine,
    143     TbVideoChannel* video_channel,
    144     TbCaptureDevice* capture_device) {
    145   RenderInWindow(
    146       video_engine->render, capture_device->captureId, _window1, 0);
    147   RenderInWindow(
    148       video_engine->render, video_channel->videoChannel, _window2, 1);
    149 }
    150