Don't crash the unit test host when tests fail.
Instead, just report the error, fail, and move on. TEST=Run vie_auto_test, option=1. On my machine most of the tests fail for some reason that I'm still investigating, but the tests shouldn't be crashing the process which is what I'm fixing here. Review URL: https://webrtc-codereview.appspot.com/929019 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3105 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
2d0b81b8af
commit
5ea70e619e
@ -36,17 +36,19 @@ void FindCaptureDeviceOnSystem(webrtc::ViECapture* capture,
|
||||
*device_video = webrtc::VideoCaptureFactory::Create(4571, unique_id);
|
||||
EXPECT_TRUE(*device_video != NULL);
|
||||
|
||||
(*device_video)->AddRef();
|
||||
if (*device_video) {
|
||||
(*device_video)->AddRef();
|
||||
|
||||
int error = capture->AllocateCaptureDevice(**device_video, *device_id);
|
||||
if (error == 0) {
|
||||
ViETest::Log("Using capture device: %s, captureId: %d.",
|
||||
device_name, *device_id);
|
||||
capture_device_set = true;
|
||||
break;
|
||||
} else {
|
||||
(*device_video)->Release();
|
||||
(*device_video) = NULL;
|
||||
int error = capture->AllocateCaptureDevice(**device_video, *device_id);
|
||||
if (error == 0) {
|
||||
ViETest::Log("Using capture device: %s, captureId: %d.",
|
||||
device_name, *device_id);
|
||||
capture_device_set = true;
|
||||
break;
|
||||
} else {
|
||||
(*device_video)->Release();
|
||||
(*device_video) = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete dev_info;
|
||||
|
@ -28,7 +28,7 @@ void ViEAutoTest::ViEBaseStandardTest() {
|
||||
int video_channel = -1;
|
||||
EXPECT_EQ(0, interfaces.base->CreateChannel(video_channel));
|
||||
|
||||
webrtc::VideoCaptureModule* video_capture_module(NULL);
|
||||
webrtc::VideoCaptureModule* video_capture_module = NULL;
|
||||
const unsigned int kMaxDeviceNameLength = 128;
|
||||
char device_name[kMaxDeviceNameLength];
|
||||
memset(device_name, 0, kMaxDeviceNameLength);
|
||||
@ -44,6 +44,10 @@ void ViEAutoTest::ViEBaseStandardTest() {
|
||||
&capture_id,
|
||||
&video_capture_module);
|
||||
|
||||
EXPECT_TRUE(video_capture_module);
|
||||
if (!video_capture_module)
|
||||
return;
|
||||
|
||||
EXPECT_EQ(0, capture_interface->ConnectCaptureDevice(capture_id,
|
||||
video_channel));
|
||||
EXPECT_EQ(0, capture_interface->StartCapture(capture_id));
|
||||
|
@ -121,10 +121,10 @@ void ViEAutoTest::ViECaptureStandardTest() {
|
||||
ASSERT_GT(number_of_capture_devices, 0)
|
||||
<< "This test requires a capture device (i.e. a webcam)";
|
||||
|
||||
int capture_device_id[10];
|
||||
memset(capture_device_id, 0, sizeof(capture_device_id));
|
||||
webrtc::VideoCaptureModule* vcpms[10];
|
||||
memset(vcpms, 0, sizeof(vcpms));
|
||||
#if !defined(WEBRTC_MAC)
|
||||
int capture_device_id[10] = {0};
|
||||
webrtc::VideoCaptureModule* vcpms[10] = {0};
|
||||
#endif
|
||||
|
||||
// Check capabilities
|
||||
for (int device_index = 0; device_index < number_of_capture_devices;
|
||||
@ -179,6 +179,9 @@ void ViEAutoTest::ViECaptureStandardTest() {
|
||||
webrtc::VideoCaptureModule* vcpm =
|
||||
webrtc::VideoCaptureFactory::Create(device_index, device_unique_name);
|
||||
EXPECT_TRUE(vcpm != NULL);
|
||||
if (!vcpm)
|
||||
continue;
|
||||
|
||||
vcpm->AddRef();
|
||||
vcpms[device_index] = vcpm;
|
||||
|
||||
@ -249,7 +252,8 @@ void ViEAutoTest::ViECaptureStandardTest() {
|
||||
EXPECT_EQ(0, video_engine.capture->ReleaseCaptureDevice(
|
||||
capture_device_id[device_index]));
|
||||
#endif // !WEBRTC_ANDROID
|
||||
vcpms[device_index]->Release();
|
||||
if (vcpms[device_index])
|
||||
vcpms[device_index]->Release();
|
||||
}
|
||||
#endif // !WEBRTC_MAC
|
||||
}
|
||||
|
@ -66,7 +66,8 @@ TbCaptureDevice::~TbCaptureDevice(void)
|
||||
{
|
||||
EXPECT_EQ(0, ViE.capture->StopCapture(captureId));
|
||||
EXPECT_EQ(0, ViE.capture->ReleaseCaptureDevice(captureId));
|
||||
vcpm_->Release();
|
||||
if (vcpm_)
|
||||
vcpm_->Release();
|
||||
}
|
||||
|
||||
void TbCaptureDevice::ConnectTo(int videoChannel)
|
||||
|
Loading…
Reference in New Issue
Block a user