Fixing coverity warnings for render module.

BUG=

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2755 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
wu@webrtc.org 2012-09-12 03:51:27 +00:00
parent 430e31c2c0
commit 633a6fa815
3 changed files with 38 additions and 30 deletions

View File

@ -1064,6 +1064,7 @@ WebRtc_Word32 VideoRenderDirect3D9::SetBitmap(const void* bitMap,
{
WEBRTC_TRACE(kTraceError, kTraceVideo, -1,
"Direct3D failed to GetDIBits in SetBitmap");
delete srcPtr;
return -1;
}
DeleteDC(hdcNew);
@ -1071,6 +1072,7 @@ WebRtc_Word32 VideoRenderDirect3D9::SetBitmap(const void* bitMap,
{
WEBRTC_TRACE(kTraceError, kTraceVideo, -1,
"Direct3D failed to SetBitmap invalid bit depth");
delete srcPtr;
return -1;
}
@ -1087,18 +1089,21 @@ WebRtc_Word32 VideoRenderDirect3D9::SetBitmap(const void* bitMap,
if (FAILED(ret))
{
_pTextureLogo = NULL;
delete srcPtr;
return -1;
}
if (!_pTextureLogo)
{
WEBRTC_TRACE(kTraceError, kTraceVideo, -1,
"Texture for rendering not initialized.");
delete srcPtr;
return -1;
}
D3DLOCKED_RECT lr;
if (FAILED(_pTextureLogo->LockRect(0, &lr, NULL, 0)))
{
delete srcPtr;
return -1;
}
unsigned char* dstPtr = (UCHAR*) lr.pBits;

View File

@ -378,17 +378,23 @@ DirectDrawChannel::DirectDrawChannel(DirectDraw* directDraw,
VideoType blitVideoType,
VideoType incomingVideoType,
VideoType screenVideoType,
VideoRenderDirectDraw* owner) :
_critSect(CriticalSectionWrapper::CreateCriticalSection()), _refCount(1),
_width(0), _height(0), _numberOfStreams(0), _doubleBuffer(false),
_directDraw(directDraw), _offScreenSurface(NULL),
_offScreenSurfaceNext(NULL), _incomingVideoType(incomingVideoType),
VideoRenderDirectDraw* owner)
: _critSect(CriticalSectionWrapper::CreateCriticalSection()),
_refCount(1),
_width(0),
_height(0),
_numberOfStreams(0),
_doubleBuffer(false),
_directDraw(directDraw),
_offScreenSurface(NULL),
_offScreenSurfaceNext(NULL),
_incomingVideoType(incomingVideoType),
_blitVideoType(blitVideoType),
_originalBlitVideoType(blitVideoType),
_screenVideoType(screenVideoType), _deliverInScreenType(false),
_owner(owner)
{
_screenVideoType(screenVideoType),
_deliverInScreenType(false),
_offScreenSurfaceUpdated(false),
_owner(owner) {
_directDraw->AddRef();
}

View File

@ -24,16 +24,14 @@
namespace webrtc {
VideoRenderWindowsImpl::VideoRenderWindowsImpl(
const WebRtc_Word32 id,
const VideoRenderType videoRenderType,
void* window,
const bool fullscreen) :
_id(id),
_renderWindowsCritsect(
*CriticalSectionWrapper::CreateCriticalSection()),
_prtWindow(window), _fullscreen(fullscreen), _ptrRendererWin(NULL)
{
VideoRenderWindowsImpl::VideoRenderWindowsImpl(const WebRtc_Word32 id,
const VideoRenderType videoRenderType, void* window, const bool fullscreen)
: _id(id),
_renderWindowsCritsect(*CriticalSectionWrapper::CreateCriticalSection()),
_prtWindow(window),
_fullscreen(fullscreen),
_renderMethod(kVideoRenderWinD3D9),
_ptrRendererWin(NULL) {
}
VideoRenderWindowsImpl::~VideoRenderWindowsImpl()
@ -51,8 +49,6 @@ WebRtc_Word32 VideoRenderWindowsImpl::Init()
//LogOSAndHardwareDetails();
CheckHWAcceleration();
_renderMethod = kVideoRenderWinD3D9;
// Create the win renderer
switch (_renderMethod)
{
@ -505,8 +501,8 @@ void VideoRenderWindowsImpl::LogOSAndHardwareDetails()
// Get the IDxDiagContainer object called "DxDiag_DisplayDevices".
// This call may take some time while dxdiag gathers the info.
if (FAILED(hr = m_pDxDiagRoot->GetChildContainer(L"DxDiag_DisplayDevices",
&pContainer)))
{
&pContainer)) ||
!pContainer) {
m_pDxDiagRoot->Release();
m_pDxDiagProvider->Release();
if (coUninitializeIsRequired)
@ -603,7 +599,8 @@ void VideoRenderWindowsImpl::LogOSAndHardwareDetails()
pDisplayInfo->m_szDriverVersion);
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, -1,
"DirectDraw Acceleration Enabled --- %s",
pDisplayInfo->m_szDescription ? "Enabled" : "Disabled");
pDisplayInfo->m_bDDAccelerationEnabled ?
"Enabled" : "Disabled");
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, -1,
"bNoHardware --- %s",
pDisplayInfo->m_bNoHardware ? "Enabled" : "Disabled");