Coverity fix for VideoRenderModule including issues 10084, 10226, 10267 and 10340.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1630 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
wu@webrtc.org 2012-02-08 00:14:25 +00:00
parent 551fcc04ec
commit 9143f774d1
2 changed files with 18 additions and 16 deletions

View File

@ -23,10 +23,11 @@ static int dispCount = 0;
VideoX11Channel::VideoX11Channel(WebRtc_Word32 id) :
_crit(*CriticalSectionWrapper::CreateCriticalSection()), _display(NULL),
_shminfo(), _image(NULL), _window(0L),
_shminfo(), _image(NULL), _window(0L), _gc(NULL),
_width(DEFAULT_RENDER_FRAME_WIDTH),
_height(DEFAULT_RENDER_FRAME_HEIGHT), _outWidth(0), _outHeight(0),
_xPos(0), _yPos(0), _prepared(false), _dispCount(0), _buffer(NULL),
_top(0.0), _left(0.0), _right(0.0), _bottom(0.0),
_Id(id)
{
}
@ -122,9 +123,9 @@ WebRtc_Word32 VideoX11Channel::Init(Window window, float left, float top,
_window = window;
_left = left;
_right = _right;
_right = right;
_top = top;
_bottom = _bottom;
_bottom = bottom;
_display = XOpenDisplay(NULL); // Use default display
if (!_window || !_display)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -482,16 +482,6 @@ ModuleVideoRenderImpl::AddIncomingRenderStream(const WebRtc_UWord32 streamId,
return NULL;
}
// Create platform independant code
IncomingVideoStream* ptrIncomingStream = new IncomingVideoStream(_id,
streamId);
if (ptrIncomingStream == NULL)
{
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id,
"%s: Can't create incoming stream", __FUNCTION__);
return NULL;
}
VideoRenderCallback* ptrRenderCallback =
_ptrRenderer->AddIncomingRenderStream(streamId, zOrder, left, top,
right, bottom);
@ -503,6 +493,17 @@ ModuleVideoRenderImpl::AddIncomingRenderStream(const WebRtc_UWord32 streamId,
return NULL;
}
// Create platform independant code
IncomingVideoStream* ptrIncomingStream = new IncomingVideoStream(_id,
streamId);
if (ptrIncomingStream == NULL)
{
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id,
"%s: Can't create incoming stream", __FUNCTION__);
return NULL;
}
if (ptrIncomingStream->SetRenderCallback(ptrRenderCallback) == -1)
{
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id,
@ -572,10 +573,10 @@ WebRtc_Word32 ModuleVideoRenderImpl::AddExternalRenderCallback(
IncomingVideoStream* ptrIncomingStream =
static_cast<IncomingVideoStream*> (mapItem->GetItem());
if (!ptrIncomingStream)
{
if (!ptrIncomingStream) {
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, _id,
"%s: could not get stream", __FUNCTION__);
return -1;
}
return ptrIncomingStream->SetExternalCallback(renderObject);
}