Fixing crash in video_render_tests in release mode.

This is a test bug. Fixed usage of assert.

BUG=1917
R=mflodman@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/9979004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5750 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrikg@webrtc.org 2014-03-21 14:41:27 +00:00
parent 16b75c2c7a
commit 6f9c48348b

View File

@ -423,6 +423,8 @@ int TestBitmapText(VideoRender* renderModule) {
}
int TestMultipleStreams(VideoRender* renderModule) {
int error = 0;
// Add settings for a stream to render
printf("Add stream 0\n");
const int streamId0 = 0;
@ -444,10 +446,19 @@ int TestMultipleStreams(VideoRender* renderModule) {
VideoRenderCallback* renderCallback3 =
renderModule->AddIncomingRenderStream(streamId3, 0, 0.55f, 0.55f, 1.0f, 1.0f);
assert(renderCallback3 != NULL);
assert(renderModule->StartRender(streamId0) == 0);
assert(renderModule->StartRender(streamId1) == 0);
assert(renderModule->StartRender(streamId2) == 0);
assert(renderModule->StartRender(streamId3) == 0);
error = renderModule->StartRender(streamId0);
if (error != 0) {
// TODO(phoglund): This test will not work if compiled in release mode.
// This rather silly construct here is to avoid compilation errors when
// compiling in release. Release => no asserts => unused 'error' variable.
assert(false);
}
error = renderModule->StartRender(streamId1);
assert(error == 0);
error = renderModule->StartRender(streamId2);
assert(error == 0);
error = renderModule->StartRender(streamId3);
assert(error == 0);
// Loop through an I420 file and render each frame
const int width = 352;
@ -493,19 +504,28 @@ int TestMultipleStreams(VideoRender* renderModule) {
// Shut down
printf("Closing...\n");
assert(renderModule->StopRender(streamId0) == 0);
assert(renderModule->DeleteIncomingRenderStream(streamId0) == 0);
assert(renderModule->StopRender(streamId1) == 0);
assert(renderModule->DeleteIncomingRenderStream(streamId1) == 0);
assert(renderModule->StopRender(streamId2) == 0);
assert(renderModule->DeleteIncomingRenderStream(streamId2) == 0);
assert(renderModule->StopRender(streamId3) == 0);
assert(renderModule->DeleteIncomingRenderStream(streamId3) == 0);
error = renderModule->StopRender(streamId0);
assert(error == 0);
error = renderModule->DeleteIncomingRenderStream(streamId0);
assert(error == 0);
error = renderModule->StopRender(streamId1);
assert(error == 0);
error = renderModule->DeleteIncomingRenderStream(streamId1);
assert(error == 0);
error = renderModule->StopRender(streamId2);
assert(error == 0);
error = renderModule->DeleteIncomingRenderStream(streamId2);
assert(error == 0);
error = renderModule->StopRender(streamId3);
assert(error == 0);
error = renderModule->DeleteIncomingRenderStream(streamId3);
assert(error == 0);
return 0;
}
int TestExternalRender(VideoRender* renderModule) {
int error = 0;
MyRenderCallback *externalRender = new MyRenderCallback();
const int streamId0 = 0;
@ -513,10 +533,16 @@ int TestExternalRender(VideoRender* renderModule) {
renderModule->AddIncomingRenderStream(streamId0, 0, 0.0f, 0.0f,
1.0f, 1.0f);
assert(renderCallback0 != NULL);
assert(renderModule->AddExternalRenderCallback(streamId0,
externalRender) == 0);
error = renderModule->AddExternalRenderCallback(streamId0, externalRender);
if (error != 0) {
// TODO(phoglund): This test will not work if compiled in release mode.
// This rather silly construct here is to avoid compilation errors when
// compiling in release. Release => no asserts => unused 'error' variable.
assert(false);
}
assert(renderModule->StartRender(streamId0) == 0);
error = renderModule->StartRender(streamId0);
assert(error == 0);
const int width = 352;
const int half_width = (width + 1) / 2;
@ -536,8 +562,12 @@ int TestExternalRender(VideoRender* renderModule) {
// Sleep and let all frames be rendered before closing
SleepMs(2*renderDelayMs);
assert(renderModule->StopRender(streamId0) == 0);
assert(renderModule->DeleteIncomingRenderStream(streamId0) == 0);
// Shut down
printf("Closing...\n");
error = renderModule->StopRender(streamId0);
assert(error == 0);
error = renderModule->DeleteIncomingRenderStream(streamId0);
assert(error == 0);
assert(frameCount == externalRender->_cnt);
delete externalRender;
@ -562,7 +592,6 @@ void RunVideoRenderTests(void* window, VideoRenderType windowType) {
windowType);
assert(renderModule != NULL);
// ##### Test single stream rendering ####
printf("#### TestSingleStream ####\n");
if (TestSingleStream(renderModule) != 0) {