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 #include "webrtc/video_engine/test/libvietest/include/tb_interfaces.h" 12 13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "webrtc/test/testsupport/fileutils.h" 15 16 TbInterfaces::TbInterfaces(const std::string& test_name) : 17 video_engine(NULL), 18 base(NULL), 19 capture(NULL), 20 render(NULL), 21 rtp_rtcp(NULL), 22 codec(NULL), 23 network(NULL), 24 image_process(NULL) 25 { 26 std::string complete_path = 27 webrtc::test::OutputPath() + test_name + "_trace.txt"; 28 29 video_engine = webrtc::VideoEngine::Create(); 30 EXPECT_TRUE(video_engine != NULL); 31 32 EXPECT_EQ(0, video_engine->SetTraceFile(complete_path.c_str())); 33 EXPECT_EQ(0, video_engine->SetTraceFilter(webrtc::kTraceAll)); 34 35 base = webrtc::ViEBase::GetInterface(video_engine); 36 EXPECT_TRUE(base != NULL); 37 38 EXPECT_EQ(0, base->Init()); 39 40 capture = webrtc::ViECapture::GetInterface(video_engine); 41 EXPECT_TRUE(capture != NULL); 42 43 rtp_rtcp = webrtc::ViERTP_RTCP::GetInterface(video_engine); 44 EXPECT_TRUE(rtp_rtcp != NULL); 45 46 render = webrtc::ViERender::GetInterface(video_engine); 47 EXPECT_TRUE(render != NULL); 48 49 codec = webrtc::ViECodec::GetInterface(video_engine); 50 EXPECT_TRUE(codec != NULL); 51 52 network = webrtc::ViENetwork::GetInterface(video_engine); 53 EXPECT_TRUE(network != NULL); 54 55 image_process = webrtc::ViEImageProcess::GetInterface(video_engine); 56 EXPECT_TRUE(image_process != NULL); 57 } 58 59 TbInterfaces::~TbInterfaces(void) 60 { 61 EXPECT_EQ(0, image_process->Release()); 62 image_process = NULL; 63 EXPECT_EQ(0, codec->Release()); 64 codec = NULL; 65 EXPECT_EQ(0, capture->Release()); 66 capture = NULL; 67 EXPECT_EQ(0, render->Release()); 68 render = NULL; 69 EXPECT_EQ(0, rtp_rtcp->Release()); 70 rtp_rtcp = NULL; 71 EXPECT_EQ(0, network->Release()); 72 network = NULL; 73 EXPECT_EQ(0, base->Release()); 74 base = NULL; 75 EXPECT_TRUE(webrtc::VideoEngine::Delete(video_engine)) << 76 "Since we have released all interfaces at this point, deletion " 77 "should be successful."; 78 video_engine = NULL; 79 } 80