VideoRender now uses pointer constructor of CriticalSectionScoped.

BUG=184
TEST=video_render_module compiles on all platforms when removing ref ctor of
CriticalSectionScoped.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1843 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/src/modules/video_render/main/source/Android/video_render_android_impl.cc b/src/modules/video_render/main/source/Android/video_render_android_impl.cc
index 22fa659..8df91d2 100644
--- a/src/modules/video_render/main/source/Android/video_render_android_impl.cc
+++ b/src/modules/video_render/main/source/Android/video_render_android_impl.cc
@@ -78,7 +78,7 @@
 
 WebRtc_Word32 VideoRenderAndroid::ChangeUniqueId(const WebRtc_Word32 id)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     _id = id;
 
     return 0;
@@ -96,7 +96,7 @@
                                             const float right,
                                             const float bottom)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
 
     AndroidStream* renderStream = NULL;
     MapItem* item = _streamsMap.Find(streamId);
@@ -129,7 +129,7 @@
 WebRtc_Word32 VideoRenderAndroid::DeleteIncomingRenderStream(
                                                              const WebRtc_UWord32 streamId)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
 
     MapItem* item = _streamsMap.Find(streamId);
     if (item)
@@ -160,7 +160,7 @@
 
 WebRtc_Word32 VideoRenderAndroid::StartRender()
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
 
     if (_javaRenderThread)
     {
@@ -201,7 +201,7 @@
 
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s:", __FUNCTION__);
     {
-        CriticalSectionScoped cs(_critSect);
+        CriticalSectionScoped cs(&_critSect);
         if (!_javaRenderThread)
         {
             return -1;
@@ -211,7 +211,7 @@
     }
 
     _javaShutdownEvent.Wait(3000);
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     _javaRenderThread->SetNotAlive();
     if (_javaRenderThread->Stop())
     {
@@ -230,7 +230,7 @@
 
 void VideoRenderAndroid::ReDraw()
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     if (_lastJavaRenderEvent < TickTime::MillisecondTimestamp() - 20) // Allow redraw if it was more than 20ms since last.
     {
         _lastJavaRenderEvent = TickTime::MillisecondTimestamp();
@@ -247,7 +247,7 @@
 {
     _javaRenderEvent.Wait(1000);
 
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     if (!_javaRenderJniEnv)
     {
         // try to attach the thread and get the env
diff --git a/src/modules/video_render/main/source/external/video_render_external_impl.cc b/src/modules/video_render/main/source/external/video_render_external_impl.cc
index 7abb09a..690be5a 100644
--- a/src/modules/video_render/main/source/external/video_render_external_impl.cc
+++ b/src/modules/video_render/main/source/external/video_render_external_impl.cc
@@ -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
@@ -34,14 +34,14 @@
 
 WebRtc_Word32 VideoRenderExternalImpl::ChangeUniqueId(const WebRtc_Word32 id)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     _id = id;
     return 0;
 }
 
 WebRtc_Word32 VideoRenderExternalImpl::ChangeWindow(void* window)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     return 0;
 }
 
@@ -53,14 +53,14 @@
                                                  const float right,
                                                  const float bottom)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     return this;
 }
 
 WebRtc_Word32 VideoRenderExternalImpl::DeleteIncomingRenderStream(
                                                                   const WebRtc_UWord32 streamId)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     return 0;
 }
 
@@ -72,7 +72,7 @@
                                                                          float& right,
                                                                          float& bottom) const
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
 
     zOrder = 0;
     left = 0;
@@ -85,13 +85,13 @@
 
 WebRtc_Word32 VideoRenderExternalImpl::StartRender()
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     return 0;
 }
 
 WebRtc_Word32 VideoRenderExternalImpl::StopRender()
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     return 0;
 }
 
@@ -107,7 +107,7 @@
 
 bool VideoRenderExternalImpl::FullScreen()
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     return _fullscreen;
 }
 
@@ -124,7 +124,7 @@
                                                            WebRtc_UWord32& screenWidth,
                                                            WebRtc_UWord32& screenHeight) const
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     screenWidth = 0;
     screenHeight = 0;
     return 0;
@@ -133,7 +133,7 @@
 WebRtc_UWord32 VideoRenderExternalImpl::RenderFrameRate(
                                                         const WebRtc_UWord32 streamId)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     return 0;
 }
 
@@ -144,7 +144,7 @@
                                                          const float right,
                                                          const float bottom)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     return 0;
 }
 
@@ -156,14 +156,14 @@
                                                          const float right,
                                                          const float bottom)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     return 0;
 }
 
 WebRtc_Word32 VideoRenderExternalImpl::SetTransparentBackground(
                                                                 const bool enable)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     return 0;
 }
 
@@ -178,7 +178,7 @@
                                                const float right,
                                                const float bottom)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     return 0;
 }
 
@@ -190,7 +190,7 @@
                                                  const float right,
                                                  const float bottom)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     return 0;
 }
 
diff --git a/src/modules/video_render/main/source/incoming_video_stream.cc b/src/modules/video_render/main/source/incoming_video_stream.cc
index 418a325..f7371ac 100644
--- a/src/modules/video_render/main/source/incoming_video_stream.cc
+++ b/src/modules/video_render/main/source/incoming_video_stream.cc
@@ -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
@@ -82,7 +82,7 @@
 
 WebRtc_Word32 IncomingVideoStream::ChangeModuleId(const WebRtc_Word32 id)
 {
-    CriticalSectionScoped cs(_streamCritsect);
+    CriticalSectionScoped cs(&_streamCritsect);
 
     _moduleId = id;
     return 0;
@@ -91,7 +91,7 @@
 VideoRenderCallback*
 IncomingVideoStream::ModuleCallback()
 {
-    CriticalSectionScoped cs(_streamCritsect);
+    CriticalSectionScoped cs(&_streamCritsect);
     return this;
 }
 
@@ -99,7 +99,7 @@
                                                VideoFrame& videoFrame)
 {
 
-    CriticalSectionScoped csS(_streamCritsect);
+    CriticalSectionScoped csS(&_streamCritsect);
     WEBRTC_TRACE(kTraceStream, kTraceVideoRenderer, _moduleId,
                  "%s for stream %d, render time: %u", __FUNCTION__, _streamId,
                  videoFrame.RenderTimeMs());
@@ -148,7 +148,7 @@
     }
 
     // Insert frame
-    CriticalSectionScoped csB(_bufferCritsect);
+    CriticalSectionScoped csB(&_bufferCritsect);
     if (_renderBuffers.AddFrame(&videoFrame) == 1)
         _deliverBufferEvent.Set();
 
@@ -157,21 +157,21 @@
 
 WebRtc_Word32 IncomingVideoStream::SetStartImage(const VideoFrame& videoFrame)
 {
-    CriticalSectionScoped csS(_threadCritsect);
+    CriticalSectionScoped csS(&_threadCritsect);
     return _startImage.CopyFrame(videoFrame);
 }
 
 WebRtc_Word32 IncomingVideoStream::SetTimeoutImage(const VideoFrame& videoFrame,
                                                    const WebRtc_UWord32 timeout)
 {
-    CriticalSectionScoped csS(_threadCritsect);
+    CriticalSectionScoped csS(&_threadCritsect);
     _timeoutTime = timeout;
     return _timeoutImage.CopyFrame(videoFrame);
 }
 
 WebRtc_Word32 IncomingVideoStream::SetRenderCallback(VideoRenderCallback* renderCallback)
 {
-    CriticalSectionScoped cs(_streamCritsect);
+    CriticalSectionScoped cs(&_streamCritsect);
 
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _moduleId,
                  "%s(%x) for stream %d", __FUNCTION__, renderCallback,
@@ -184,7 +184,7 @@
                                                    const bool mirrorXAxis,
                                                    const bool mirrorYAxis)
 {
-    CriticalSectionScoped cs(_streamCritsect);
+    CriticalSectionScoped cs(&_streamCritsect);
     _mirrorFramesEnabled = enable;
     _mirroring.mirrorXAxis = mirrorXAxis;
     _mirroring.mirrorYAxis = mirrorYAxis;
@@ -194,7 +194,7 @@
 
 WebRtc_Word32 IncomingVideoStream::SetExternalCallback(VideoRenderCallback* externalCallback)
 {
-    CriticalSectionScoped cs(_streamCritsect);
+    CriticalSectionScoped cs(&_streamCritsect);
 
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _moduleId,
                  "%s(%x) for stream %d", __FUNCTION__, externalCallback,
@@ -208,7 +208,7 @@
 
 WebRtc_Word32 IncomingVideoStream::Start()
 {
-    CriticalSectionScoped csS(_streamCritsect);
+    CriticalSectionScoped csS(&_streamCritsect);
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _moduleId,
                  "%s for stream %d", __FUNCTION__, _streamId);
     if (_running)
@@ -218,7 +218,7 @@
         return 0;
     }
 
-    CriticalSectionScoped csT(_threadCritsect);
+    CriticalSectionScoped csT(&_threadCritsect);
     assert(_ptrIncomingRenderThread == NULL);
 
     _ptrIncomingRenderThread
@@ -252,7 +252,7 @@
 
 WebRtc_Word32 IncomingVideoStream::Stop()
 {
-    CriticalSectionScoped csStream(_streamCritsect);
+    CriticalSectionScoped csStream(&_streamCritsect);
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _moduleId,
                  "%s for stream %d", __FUNCTION__, _streamId);
 
@@ -294,8 +294,8 @@
 
 WebRtc_Word32 IncomingVideoStream::Reset()
 {
-    CriticalSectionScoped csStream(_streamCritsect);
-    CriticalSectionScoped csBuffer(_bufferCritsect);
+    CriticalSectionScoped csStream(&_streamCritsect);
+    CriticalSectionScoped csBuffer(&_bufferCritsect);
 
     _renderBuffers.ReleaseAllFrames();
     return 0;
@@ -303,13 +303,13 @@
 
 WebRtc_UWord32 IncomingVideoStream::StreamId() const
 {
-    CriticalSectionScoped csStream(_streamCritsect);
+    CriticalSectionScoped csStream(&_streamCritsect);
     return _streamId;
 }
 
 WebRtc_UWord32 IncomingVideoStream::IncomingRate() const
 {
-    CriticalSectionScoped cs(_streamCritsect);
+    CriticalSectionScoped cs(&_streamCritsect);
     return _incomingRate;
 }
 
@@ -396,7 +396,7 @@
         // We're done with this frame, delete it.
         if (ptrFrameToRender)
         {
-            CriticalSectionScoped cs(_bufferCritsect);
+            CriticalSectionScoped cs(&_bufferCritsect);
             _lastRenderedFrame.SwapFrame(*ptrFrameToRender);
             _renderBuffers.ReturnFrame(ptrFrameToRender);
         }
@@ -405,7 +405,7 @@
 }
 WebRtc_Word32 IncomingVideoStream::GetLastRenderedFrame(VideoFrame& videoFrame) const
 {
-    CriticalSectionScoped cs(_bufferCritsect);
+    CriticalSectionScoped cs(&_bufferCritsect);
     return videoFrame.CopyFrame(_lastRenderedFrame);
 }
 
diff --git a/src/modules/video_render/main/source/linux/video_render_linux_impl.cc b/src/modules/video_render/main/source/linux/video_render_linux_impl.cc
index a5e311a..3dc8ebc 100644
--- a/src/modules/video_render/main/source/linux/video_render_linux_impl.cc
+++ b/src/modules/video_render/main/source/linux/video_render_linux_impl.cc
@@ -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
@@ -43,7 +43,7 @@
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s",
                  __FUNCTION__);
 
-    CriticalSectionScoped cs(_renderLinuxCritsect);
+    CriticalSectionScoped cs(&_renderLinuxCritsect);
     _ptrX11Render = new VideoX11Render((Window) _ptrWindow);
     if (!_ptrX11Render)
     {
@@ -64,7 +64,7 @@
 
 WebRtc_Word32 VideoRenderLinuxImpl::ChangeUniqueId(const WebRtc_Word32 id)
 {
-    CriticalSectionScoped cs(_renderLinuxCritsect);
+    CriticalSectionScoped cs(&_renderLinuxCritsect);
 
     _id = id;
     return 0;
@@ -75,7 +75,7 @@
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s",
                  __FUNCTION__);
 
-    CriticalSectionScoped cs(_renderLinuxCritsect);
+    CriticalSectionScoped cs(&_renderLinuxCritsect);
     _ptrWindow = window;
 
     if (_ptrX11Render)
@@ -96,7 +96,7 @@
 {
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s",
                  __FUNCTION__);
-    CriticalSectionScoped cs(_renderLinuxCritsect);
+    CriticalSectionScoped cs(&_renderLinuxCritsect);
 
     VideoRenderCallback* renderCallback = NULL;
     if (_ptrX11Render)
@@ -127,7 +127,7 @@
 {
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s",
                  __FUNCTION__);
-    CriticalSectionScoped cs(_renderLinuxCritsect);
+    CriticalSectionScoped cs(&_renderLinuxCritsect);
 
     if (_ptrX11Render)
     {
@@ -146,7 +146,7 @@
 {
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s",
                  __FUNCTION__);
-    CriticalSectionScoped cs(_renderLinuxCritsect);
+    CriticalSectionScoped cs(&_renderLinuxCritsect);
 
     if (_ptrX11Render)
     {
diff --git a/src/modules/video_render/main/source/linux/video_x11_channel.cc b/src/modules/video_render/main/source/linux/video_x11_channel.cc
index 5f8bfa1..4d574e3 100644
--- a/src/modules/video_render/main/source/linux/video_x11_channel.cc
+++ b/src/modules/video_render/main/source/linux/video_x11_channel.cc
@@ -46,7 +46,7 @@
 WebRtc_Word32 VideoX11Channel::RenderFrame(const WebRtc_UWord32 streamId,
                                                VideoFrame& videoFrame)
 {
-    CriticalSectionScoped cs(_crit);
+    CriticalSectionScoped cs(&_crit);
     if (_width != (WebRtc_Word32) videoFrame.Width() || _height
             != (WebRtc_Word32) videoFrame.Height())
     {
@@ -63,7 +63,7 @@
                                                    WebRtc_Word32 height,
                                                    WebRtc_Word32 /*numberOfStreams */)
 {
-    CriticalSectionScoped cs(_crit);
+    CriticalSectionScoped cs(&_crit);
     if (_prepared)
     {
         RemoveRenderer();
@@ -80,7 +80,7 @@
                                                 WebRtc_Word32 bufferSize,
                                                 unsigned WebRtc_Word32 /*timeStamp90kHz*/)
 {
-    CriticalSectionScoped cs(_crit);
+    CriticalSectionScoped cs(&_crit);
     if (!_prepared)
     {
         return 0;
@@ -119,7 +119,7 @@
 {
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _Id, "%s",
                  __FUNCTION__);
-    CriticalSectionScoped cs(_crit);
+    CriticalSectionScoped cs(&_crit);
 
     _window = window;
     _left = left;
@@ -188,7 +188,7 @@
 {
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _Id, "%s",
                  __FUNCTION__);
-    CriticalSectionScoped cs(_crit);
+    CriticalSectionScoped cs(&_crit);
 
     // Stop the rendering, if we are rendering...
     RemoveRenderer();
@@ -224,7 +224,7 @@
 {
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _Id, "%s",
                  __FUNCTION__);
-    CriticalSectionScoped cs(_crit);
+    CriticalSectionScoped cs(&_crit);
 
     RemoveRenderer();
     if (_gc) {
@@ -244,7 +244,7 @@
 {
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _Id, "%s",
                  __FUNCTION__);
-    CriticalSectionScoped cs(_crit);
+    CriticalSectionScoped cs(&_crit);
 
     if (!_window || !_display)
     {
diff --git a/src/modules/video_render/main/source/linux/video_x11_render.cc b/src/modules/video_render/main/source/linux/video_x11_render.cc
index a3543e3..9e29fe3 100644
--- a/src/modules/video_render/main/source/linux/video_x11_render.cc
+++ b/src/modules/video_render/main/source/linux/video_x11_render.cc
@@ -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
@@ -29,7 +29,7 @@
 
 WebRtc_Word32 VideoX11Render::Init()
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
 
     _streamIdToX11ChannelMap.clear();
 
@@ -38,7 +38,7 @@
 
 WebRtc_Word32 VideoX11Render::ChangeWindow(Window window)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     VideoX11Channel* renderChannel = NULL;
 
     std::map<int, VideoX11Channel*>::iterator iter =
@@ -67,7 +67,7 @@
                                                                 const float right,
                                                                 const float bottom)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
     VideoX11Channel* renderChannel = NULL;
 
     std::map<int, VideoX11Channel*>::iterator iter =
@@ -101,7 +101,7 @@
 
 WebRtc_Word32 VideoX11Render::DeleteX11RenderChannel(WebRtc_Word32 streamId)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
 
     std::map<int, VideoX11Channel*>::iterator iter =
             _streamIdToX11ChannelMap.find(streamId);
@@ -131,7 +131,7 @@
                                                               float& right,
                                                               float& bottom)
 {
-    CriticalSectionScoped cs(_critSect);
+    CriticalSectionScoped cs(&_critSect);
 
     std::map<int, VideoX11Channel*>::iterator iter =
             _streamIdToX11ChannelMap.find(streamId);
diff --git a/src/modules/video_render/main/source/mac/video_render_agl.cc b/src/modules/video_render/main/source/mac/video_render_agl.cc
index e968865..fc78b93 100644
--- a/src/modules/video_render/main/source/mac/video_render_agl.cc
+++ b/src/modules/video_render/main/source/mac/video_render_agl.cc
@@ -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
@@ -813,7 +813,7 @@
 
 int VideoRenderAGL::DeleteAllAGLChannels()
 {
-    CriticalSectionScoped cs(_renderCritSec);
+    CriticalSectionScoped cs(&_renderCritSec);
 
     //WEBRTC_TRACE(kTraceInfo, "%s:%d Deleting all AGL channels", __FUNCTION__, __LINE__);
     //int i = 0 ;
@@ -835,7 +835,7 @@
 
 int VideoRenderAGL::DeleteAGLChannel(int channel)
 {
-    CriticalSectionScoped cs(_renderCritSec);
+    CriticalSectionScoped cs(&_renderCritSec);
     //WEBRTC_TRACE(kTraceDebug, "%s:%d Deleting AGL channel %d", __FUNCTION__, __LINE__, channel);
 
     std::map<int, VideoChannelAGL*>::iterator it;
@@ -867,7 +867,7 @@
 
 int VideoRenderAGL::StopThread()
 {
-    CriticalSectionScoped cs(_renderCritSec);
+    CriticalSectionScoped cs(&_renderCritSec);
     ThreadWrapper* tmpPtr = _screenUpdateThread;
     //_screenUpdateThread = NULL;
 
@@ -889,14 +889,14 @@
 
 bool VideoRenderAGL::IsFullScreen()
 {
-    CriticalSectionScoped cs(_renderCritSec);
+    CriticalSectionScoped cs(&_renderCritSec);
     return _fullScreen;
 }
 
 bool VideoRenderAGL::HasChannels()
 {
 
-    CriticalSectionScoped cs(_renderCritSec);
+    CriticalSectionScoped cs(&_renderCritSec);
 
     if (_aglChannels.begin() != _aglChannels.end())
     {
@@ -908,7 +908,7 @@
 
 bool VideoRenderAGL::HasChannel(int channel)
 {
-    CriticalSectionScoped cs(_renderCritSec);
+    CriticalSectionScoped cs(&_renderCritSec);
 
     std::map<int, VideoChannelAGL*>::iterator it = _aglChannels.find(channel);
     if (it != _aglChannels.end())
@@ -922,7 +922,7 @@
 int VideoRenderAGL::GetChannels(std::list<int>& channelList)
 {
 
-    CriticalSectionScoped cs(_renderCritSec);
+    CriticalSectionScoped cs(&_renderCritSec);
     std::map<int, VideoChannelAGL*>::iterator it = _aglChannels.begin();
 
     while (it != _aglChannels.end())
@@ -937,7 +937,7 @@
 VideoChannelAGL* VideoRenderAGL::ConfigureAGLChannel(int channel, int zOrder, float startWidth, float startHeight, float stopWidth, float stopHeight)
 {
 
-    CriticalSectionScoped cs(_renderCritSec);
+    CriticalSectionScoped cs(&_renderCritSec);
 
     std::map<int, VideoChannelAGL*>::iterator it = _aglChannels.find(channel);
 
diff --git a/src/modules/video_render/main/source/mac/video_render_mac_carbon_impl.cc b/src/modules/video_render/main/source/mac/video_render_mac_carbon_impl.cc
index 88dc1e6..aec73bc 100644
--- a/src/modules/video_render/main/source/mac/video_render_mac_carbon_impl.cc
+++ b/src/modules/video_render/main/source/mac/video_render_mac_carbon_impl.cc
@@ -42,7 +42,7 @@
 WebRtc_Word32
 VideoRenderMacCarbonImpl::Init()
 {
-    CriticalSectionScoped cs(_renderMacCarbonCritsect);
+    CriticalSectionScoped cs(&_renderMacCarbonCritsect);
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s:%d", __FUNCTION__, __LINE__);
 
     if (!_ptrWindow)
@@ -101,7 +101,7 @@
 {
     return -1;
 
-    CriticalSectionScoped cs(_renderMacCarbonCritsect);
+    CriticalSectionScoped cs(&_renderMacCarbonCritsect);
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s", __FUNCTION__);
     _id = id;
 
@@ -117,7 +117,7 @@
 VideoRenderMacCarbonImpl::ChangeWindow(void* window)
 {
     return -1;
-    CriticalSectionScoped cs(_renderMacCarbonCritsect);
+    CriticalSectionScoped cs(&_renderMacCarbonCritsect);
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s changing ID to ", __FUNCTION__, window);
 
     if (window == NULL)
@@ -141,7 +141,7 @@
         const float bottom)
 {
 
-    CriticalSectionScoped cs(_renderMacCarbonCritsect);
+    CriticalSectionScoped cs(&_renderMacCarbonCritsect);
     WEBRTC_TRACE(kTraceDebug, kTraceVideoRenderer, _id, "%s", __FUNCTION__);
     VideoChannelAGL* AGLChannel = NULL;
 
@@ -163,7 +163,7 @@
 {
 
     WEBRTC_TRACE(kTraceDebug, kTraceVideoRenderer, _id, "%s:%d", __FUNCTION__, __LINE__);
-    CriticalSectionScoped cs(_renderMacCarbonCritsect);
+    CriticalSectionScoped cs(&_renderMacCarbonCritsect);
     _ptrCarbonRender->DeleteAGLChannel(streamId);
 
     return 0;
@@ -224,7 +224,7 @@
 VideoRenderMacCarbonImpl::GetScreenResolution(WebRtc_UWord32& screenWidth,
         WebRtc_UWord32& screenHeight) const
 {
-    CriticalSectionScoped cs(_renderMacCarbonCritsect);
+    CriticalSectionScoped cs(&_renderMacCarbonCritsect);
     //NSScreen* mainScreen = [NSScreen mainScreen];
 
     //NSRect frame = [mainScreen frame];
@@ -237,7 +237,7 @@
 WebRtc_UWord32
 VideoRenderMacCarbonImpl::RenderFrameRate(const WebRtc_UWord32 streamId)
 {
-    CriticalSectionScoped cs(_renderMacCarbonCritsect);
+    CriticalSectionScoped cs(&_renderMacCarbonCritsect);
     return 0;
 }
 
diff --git a/src/modules/video_render/main/source/mac/video_render_mac_cocoa_impl.mm b/src/modules/video_render/main/source/mac/video_render_mac_cocoa_impl.mm
index 4698b6e..bc5057f 100644
--- a/src/modules/video_render/main/source/mac/video_render_mac_cocoa_impl.mm
+++ b/src/modules/video_render/main/source/mac/video_render_mac_cocoa_impl.mm
@@ -48,7 +48,7 @@
 VideoRenderMacCocoaImpl::Init()
 {
 
-    CriticalSectionScoped cs(_renderMacCocoaCritsect);
+    CriticalSectionScoped cs(&_renderMacCocoaCritsect);
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s:%d", __FUNCTION__, __LINE__);
 
     // cast ptrWindow from void* to CocoaRenderer. Void* was once NSOpenGLView, and CocoaRenderer is NSOpenGLView.
@@ -71,7 +71,7 @@
 WebRtc_Word32
 VideoRenderMacCocoaImpl::ChangeUniqueId(const WebRtc_Word32 id)
 {
-    CriticalSectionScoped cs(_renderMacCocoaCritsect);
+    CriticalSectionScoped cs(&_renderMacCocoaCritsect);
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s", __FUNCTION__);
     _id = id;
 
@@ -87,7 +87,7 @@
 VideoRenderMacCocoaImpl::ChangeWindow(void* window)
 {
 
-    CriticalSectionScoped cs(_renderMacCocoaCritsect);
+    CriticalSectionScoped cs(&_renderMacCocoaCritsect);
     WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s changing ID to ", __FUNCTION__, window);
 
     if (window == NULL)
@@ -111,7 +111,7 @@
         const float right,
         const float bottom)
 {
-    CriticalSectionScoped cs(_renderMacCocoaCritsect);
+    CriticalSectionScoped cs(&_renderMacCocoaCritsect);
     WEBRTC_TRACE(kTraceDebug, kTraceVideoRenderer, _id, "%s", __FUNCTION__);
     VideoChannelNSOpenGL* nsOpenGLChannel = NULL;
 
@@ -132,7 +132,7 @@
 VideoRenderMacCocoaImpl::DeleteIncomingRenderStream(const WebRtc_UWord32 streamId)
 {
     WEBRTC_TRACE(kTraceDebug, kTraceVideoRenderer, _id, "Constructor %s:%d", __FUNCTION__, __LINE__);
-    CriticalSectionScoped cs(_renderMacCocoaCritsect);
+    CriticalSectionScoped cs(&_renderMacCocoaCritsect);
     _ptrCocoaRender->DeleteNSGLChannel(streamId);
 
     return 0;
@@ -192,7 +192,7 @@
 VideoRenderMacCocoaImpl::GetScreenResolution(WebRtc_UWord32& screenWidth,
         WebRtc_UWord32& screenHeight) const
 {
-    CriticalSectionScoped cs(_renderMacCocoaCritsect);
+    CriticalSectionScoped cs(&_renderMacCocoaCritsect);
     NSScreen* mainScreen = [NSScreen mainScreen];
 
     NSRect frame = [mainScreen frame];
@@ -205,7 +205,7 @@
 WebRtc_UWord32
 VideoRenderMacCocoaImpl::RenderFrameRate(const WebRtc_UWord32 streamId)
 {
-    CriticalSectionScoped cs(_renderMacCocoaCritsect);
+    CriticalSectionScoped cs(&_renderMacCocoaCritsect);
     return 0;
 }
 
diff --git a/src/modules/video_render/main/source/mac/video_render_nsopengl.mm b/src/modules/video_render/main/source/mac/video_render_nsopengl.mm
index 4f1a6c5..e63f50c 100644
--- a/src/modules/video_render/main/source/mac/video_render_nsopengl.mm
+++ b/src/modules/video_render/main/source/mac/video_render_nsopengl.mm
@@ -749,7 +749,7 @@
 
 VideoChannelNSOpenGL* VideoRenderNSOpenGL::CreateNSGLChannel(int channel, int zOrder, float startWidth, float startHeight, float stopWidth, float stopHeight)
 {
-    CriticalSectionScoped cs(_nsglContextCritSec);
+    CriticalSectionScoped cs(&_nsglContextCritSec);
 
     if (HasChannel(channel))
     {
@@ -784,7 +784,7 @@
 int VideoRenderNSOpenGL::DeleteAllNSGLChannels()
 {
 
-    CriticalSectionScoped cs(_nsglContextCritSec);
+    CriticalSectionScoped cs(&_nsglContextCritSec);
 
     std::map<int, VideoChannelNSOpenGL*>::iterator it;
     it = _nsglChannels.begin();
@@ -803,7 +803,7 @@
 WebRtc_Word32 VideoRenderNSOpenGL::DeleteNSGLChannel(const WebRtc_UWord32 channel)
 {
 
-    CriticalSectionScoped cs(_nsglContextCritSec);
+    CriticalSectionScoped cs(&_nsglContextCritSec);
 
     std::map<int, VideoChannelNSOpenGL*>::iterator it;
     it = _nsglChannels.find(channel);
@@ -839,7 +839,7 @@
         float& bottom)
 {
 
-    CriticalSectionScoped cs(_nsglContextCritSec);
+    CriticalSectionScoped cs(&_nsglContextCritSec);
 
     bool channelFound = false;
 
@@ -902,13 +902,13 @@
 bool VideoRenderNSOpenGL::IsFullScreen()
 {
 
-    CriticalSectionScoped cs(_nsglContextCritSec);
+    CriticalSectionScoped cs(&_nsglContextCritSec);
     return _fullScreen;
 }
 
 bool VideoRenderNSOpenGL::HasChannels()
 {
-    CriticalSectionScoped cs(_nsglContextCritSec);
+    CriticalSectionScoped cs(&_nsglContextCritSec);
 
     if (_nsglChannels.begin() != _nsglChannels.end())
     {
@@ -920,7 +920,7 @@
 bool VideoRenderNSOpenGL::HasChannel(int channel)
 {
 
-    CriticalSectionScoped cs(_nsglContextCritSec);
+    CriticalSectionScoped cs(&_nsglContextCritSec);
 
     std::map<int, VideoChannelNSOpenGL*>::iterator it = _nsglChannels.find(channel);
 
@@ -934,7 +934,7 @@
 int VideoRenderNSOpenGL::GetChannels(std::list<int>& channelList)
 {
 
-    CriticalSectionScoped cs(_nsglContextCritSec);
+    CriticalSectionScoped cs(&_nsglContextCritSec);
 
     std::map<int, VideoChannelNSOpenGL*>::iterator it = _nsglChannels.begin();
 
@@ -950,7 +950,7 @@
 VideoChannelNSOpenGL* VideoRenderNSOpenGL::ConfigureNSGLChannel(int channel, int zOrder, float startWidth, float startHeight, float stopWidth, float stopHeight)
 {
 
-    CriticalSectionScoped cs(_nsglContextCritSec);
+    CriticalSectionScoped cs(&_nsglContextCritSec);
 
     std::map<int, VideoChannelNSOpenGL*>::iterator it = _nsglChannels.find(channel);
 
@@ -1066,7 +1066,7 @@
 int VideoRenderNSOpenGL::CreateMixingContext()
 {
 
-    CriticalSectionScoped cs(_nsglContextCritSec);
+    CriticalSectionScoped cs(&_nsglContextCritSec);
 
     if(_fullScreen)
     {
@@ -1160,7 +1160,7 @@
 int VideoRenderNSOpenGL::GetWindowRect(Rect& rect)
 {
 
-    CriticalSectionScoped cs(_nsglContextCritSec);
+    CriticalSectionScoped cs(&_nsglContextCritSec);
 
     if (_windowRef)
     {
@@ -1191,7 +1191,7 @@
 WebRtc_Word32 VideoRenderNSOpenGL::ChangeUniqueID(WebRtc_Word32 id)
 {
 
-    CriticalSectionScoped cs(_nsglContextCritSec);
+    CriticalSectionScoped cs(&_nsglContextCritSec);
     _id = id;
     return 0;
 }
diff --git a/src/modules/video_render/main/source/video_render_impl.cc b/src/modules/video_render/main/source/video_render_impl.cc
index 616d03b..1012244 100644
--- a/src/modules/video_render/main/source/video_render_impl.cc
+++ b/src/modules/video_render/main/source/video_render_impl.cc
@@ -322,7 +322,7 @@
 WebRtc_Word32 ModuleVideoRenderImpl::ChangeUniqueId(const WebRtc_Word32 id)
 {
 
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     _id = id;
 
@@ -348,14 +348,14 @@
 void*
 ModuleVideoRenderImpl::Window()
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
     return _ptrWindow;
 }
 
 WebRtc_Word32 ModuleVideoRenderImpl::ChangeWindow(void* window)
 {
 
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
 #ifdef WEBRTC_INCLUDE_INTERNAL_VIDEO_RENDER
 
@@ -409,14 +409,14 @@
 
 WebRtc_Word32 ModuleVideoRenderImpl::Id()
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
     return _id;
 }
 
 WebRtc_UWord32 ModuleVideoRenderImpl::GetIncomingFrameRate(
                                                            const WebRtc_UWord32 streamId)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     MapItem* mapItem = _streamRenderMap.Find(streamId);
     if (mapItem == NULL)
@@ -446,7 +446,7 @@
                                                const float right,
                                                const float bottom)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -506,7 +506,7 @@
 WebRtc_Word32 ModuleVideoRenderImpl::DeleteIncomingRenderStream(
                                                                 const WebRtc_UWord32 streamId)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -537,7 +537,7 @@
                                                                const WebRtc_UWord32 streamId,
                                                                VideoRenderCallback* renderObject)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     MapItem* mapItem = _streamRenderMap.Find(streamId);
     if (!mapItem)
@@ -565,7 +565,7 @@
                                                                        float& right,
                                                                        float& bottom) const
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -581,7 +581,7 @@
 
 WebRtc_UWord32 ModuleVideoRenderImpl::GetNumIncomingRenderStreams() const
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     return (WebRtc_UWord32) _streamRenderMap.Size();
 }
@@ -589,7 +589,7 @@
 bool ModuleVideoRenderImpl::HasIncomingRenderStream(
                                                     const WebRtc_UWord32 streamId) const
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     bool hasStream = false;
     if (_streamRenderMap.Find(streamId) != NULL)
@@ -608,7 +608,7 @@
 
 WebRtc_Word32 ModuleVideoRenderImpl::StartRender(const WebRtc_UWord32 streamId)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -641,7 +641,7 @@
 
 WebRtc_Word32 ModuleVideoRenderImpl::StopRender(const WebRtc_UWord32 streamId)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -669,7 +669,7 @@
 
 WebRtc_Word32 ModuleVideoRenderImpl::ResetRender()
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     WebRtc_Word32 error = 0;
 
@@ -690,7 +690,7 @@
 
 RawVideoType ModuleVideoRenderImpl::PreferredVideoType() const
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (_ptrRenderer == NULL)
     {
@@ -702,7 +702,7 @@
 
 bool ModuleVideoRenderImpl::IsFullScreen()
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -717,7 +717,7 @@
                                                          WebRtc_UWord32& screenWidth,
                                                          WebRtc_UWord32& screenHeight) const
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -731,7 +731,7 @@
 WebRtc_UWord32 ModuleVideoRenderImpl::RenderFrameRate(
                                                       const WebRtc_UWord32 streamId)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -749,7 +749,7 @@
                                                        const float right,
                                                        const float bottom)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -762,7 +762,7 @@
 
 WebRtc_Word32 ModuleVideoRenderImpl::SetTransparentBackground(const bool enable)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -789,7 +789,7 @@
                                              const float right,
                                              const float bottom)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -809,7 +809,7 @@
                                                const float right,
                                                const float bottom)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -825,7 +825,7 @@
                                                           const WebRtc_UWord32 streamId,
                                                           VideoFrame &frame) const
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -862,7 +862,7 @@
                                                        const float right,
                                                        const float bottom)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -878,7 +878,7 @@
                                                    const WebRtc_UWord32 streamId,
                                                    const VideoFrame& videoFrame)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -913,7 +913,7 @@
                                                      const VideoFrame& videoFrame,
                                                      const WebRtc_UWord32 timeout)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
@@ -947,7 +947,7 @@
                                                         const bool mirrorXAxis,
                                                         const bool mirrorYAxis)
 {
-    CriticalSectionScoped cs(_moduleCrit);
+    CriticalSectionScoped cs(&_moduleCrit);
 
     if (!_ptrRenderer)
     {
diff --git a/src/modules/video_render/main/source/windows/video_render_direct3d9.cc b/src/modules/video_render/main/source/windows/video_render_direct3d9.cc
index 00bc41b..7e2509d 100644
--- a/src/modules/video_render/main/source/windows/video_render_direct3d9.cc
+++ b/src/modules/video_render/main/source/windows/video_render_direct3d9.cc
@@ -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
@@ -116,7 +116,7 @@
                  "FrameSizeChange, wifth: %d, height: %d, streams: %d", width,
                  height, numberOfStreams);
 
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
     _width = width;
     _height = height;
 
@@ -145,7 +145,7 @@
 WebRtc_Word32 D3D9Channel::RenderFrame(const WebRtc_UWord32 streamId,
                                            VideoFrame& videoFrame)
 {
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
     if (_width != videoFrame.Width() || _height != videoFrame.Height())
     {
         if (FrameSizeChange(videoFrame.Width(), videoFrame.Height(), 1) == -1)
@@ -165,7 +165,7 @@
     WEBRTC_TRACE(kTraceStream, kTraceVideo, -1,
                  "DeliverFrame to D3D9Channel");
 
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
 
     //FIXME if _bufferIsUpdated is still true (not be renderred), do we what to update the texture?)
     //probably not
@@ -219,7 +219,7 @@
 {
     WEBRTC_TRACE(kTraceStream, kTraceVideo, -1,
                  "Frame has been rendered to the screen.");
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
     _bufferIsUpdated = false;
     return 0;
 }
@@ -227,7 +227,7 @@
 // Called by d3d channel owner to check if the texture is updated
 int D3D9Channel::IsUpdated(bool& isUpdated)
 {
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
     isUpdated = _bufferIsUpdated;
     return 0;
 }
@@ -235,13 +235,13 @@
 // Called by d3d channel owner to get the texture
 LPDIRECT3DTEXTURE9 D3D9Channel::GetTexture()
 {
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
     return _pTexture;
 }
 
 int D3D9Channel::ReleaseTexture()
 {
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
 
     //release the texture
     if (_pTexture != NULL)
@@ -255,7 +255,7 @@
 
 int D3D9Channel::RecreateTexture(LPDIRECT3DDEVICE9 pd3DDevice)
 {
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
 
     _pd3dDevice = pd3DDevice;
 
@@ -421,7 +421,7 @@
     WEBRTC_TRACE(kTraceInfo, kTraceVideo, -1,
                  "VideoRenderDirect3D9::ResetDevice");
 
-    CriticalSectionScoped cs(_refD3DCritsect);
+    CriticalSectionScoped cs(&_refD3DCritsect);
 
     //release the channel texture
     std::map<int, D3D9Channel*>::iterator it;
@@ -552,7 +552,7 @@
     WEBRTC_TRACE(kTraceInfo, kTraceVideo, -1,
                  "VideoRenderDirect3D9::Init");
 
-    CriticalSectionScoped cs(_refD3DCritsect);
+    CriticalSectionScoped cs(&_refD3DCritsect);
 
     // Start rendering thread...
     if (!_screenUpdateThread)
@@ -586,7 +586,7 @@
 
 int VideoRenderDirect3D9::UpdateRenderSurface()
 {
-    CriticalSectionScoped cs(_refD3DCritsect);
+    CriticalSectionScoped cs(&_refD3DCritsect);
 
     // Check if there are any updated buffers
     bool updated = false;
@@ -692,7 +692,7 @@
     if (!pTexture)
         return -1;
 
-    CriticalSectionScoped cs(_refD3DCritsect);
+    CriticalSectionScoped cs(&_refD3DCritsect);
     if (SUCCEEDED(pTexture->LockRect(0, &lr, NULL, D3DLOCK_DISCARD)))
     {
         for (DWORD y = 0; y < height; y++)
@@ -774,7 +774,7 @@
 
 int VideoRenderDirect3D9::CloseDevice()
 {
-    CriticalSectionScoped cs(_refD3DCritsect);
+    CriticalSectionScoped cs(&_refD3DCritsect);
     WEBRTC_TRACE(kTraceInfo, kTraceVideo, -1,
                  "VideoRenderDirect3D9::CloseDevice");
 
@@ -827,7 +827,7 @@
 
 WebRtc_Word32 VideoRenderDirect3D9::DeleteChannel(const WebRtc_UWord32 streamId)
 {
-    CriticalSectionScoped cs(_refD3DCritsect);
+    CriticalSectionScoped cs(&_refD3DCritsect);
 
 
     std::multimap<int, unsigned int>::iterator it;
@@ -861,7 +861,7 @@
                                                                  const float right,
                                                                  const float bottom)
 {
-    CriticalSectionScoped cs(_refD3DCritsect);
+    CriticalSectionScoped cs(&_refD3DCritsect);
 
     //FIXME this should be done in VideoAPIWindows? stop the frame deliver first
     //remove the old channel	
@@ -1036,7 +1036,7 @@
         return -1;
     }
 
-    CriticalSectionScoped cs(_refD3DCritsect);
+    CriticalSectionScoped cs(&_refD3DCritsect);
 
     unsigned char* srcPtr;
     HGDIOBJ oldhand;
diff --git a/src/modules/video_render/main/source/windows/video_render_directdraw.cc b/src/modules/video_render/main/source/windows/video_render_directdraw.cc
index 034f710..42d076e 100644
--- a/src/modules/video_render/main/source/windows/video_render_directdraw.cc
+++ b/src/modules/video_render/main/source/windows/video_render_directdraw.cc
@@ -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
@@ -422,7 +422,7 @@
 
 void DirectDrawChannel::AddRef()
 {
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
     _refCount++;
 }
 
@@ -454,7 +454,7 @@
     lookupID <<= 11;
     lookupID += streamId;
 
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
 
     DirectDrawStreamSettings* streamSettings = NULL;
 
@@ -490,7 +490,7 @@
     lookupID <<= 11;
     lookupID += streamId;
 
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
 
     DirectDrawStreamSettings* streamSettings = NULL;
     std::map<unsigned long long, DirectDrawStreamSettings*>::iterator it =
@@ -516,7 +516,7 @@
                                              float& stopWidth,
                                              float& stopHeight)
 {
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
 
     unsigned long long lookupID = reinterpret_cast<unsigned long long> (DDObj);
     lookupID &= 0xffffffffffffffe0;
@@ -542,13 +542,13 @@
 
 bool DirectDrawChannel::IsOffScreenSurfaceUpdated(VideoRenderDirectDraw* DDobj)
 {
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
     return _offScreenSurfaceUpdated;
 }
 
 void DirectDrawChannel::GetLargestSize(RECT* mixingRect)
 {
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
     if (mixingRect)
     {
         if (mixingRect->bottom < _height)
@@ -571,7 +571,7 @@
 WebRtc_Word32 DirectDrawChannel::RenderFrame(const WebRtc_UWord32 streamId,
                                                  VideoFrame& videoFrame)
 {
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
     if (_width != videoFrame.Width() || _height != videoFrame.Height())
     {
         if (FrameSizeChange(videoFrame.Width(), videoFrame.Height(), 1) == -1)
@@ -586,7 +586,7 @@
 int DirectDrawChannel::FrameSizeChange(int width, int height,
                                            int numberOfStreams)
 {
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
 
     if (_directDraw == NULL)
     {
@@ -899,7 +899,7 @@
 int DirectDrawChannel::DeliverFrame(unsigned char* buffer, int bufferSize,
                                         unsigned int /*timeStamp90KHz*/)
 {
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
 
     if (CalcBufferSize(_incomingVideoType, _width, _height)
             != bufferSize)
@@ -1086,7 +1086,7 @@
     lookupID <<= 11;
     lookupID += streamID;
 
-    CriticalSectionScoped cs(*_critSect);
+    CriticalSectionScoped cs(_critSect);
 
     if (_offScreenSurface == NULL)
     {
@@ -1674,7 +1674,7 @@
                                                            WebRtc_UWord64& totalMemory,
                                                            WebRtc_UWord64& availableMemory)
 {
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
 
     if (_totalMemory == -1 || _availableMemory == -1)
     {
@@ -1690,7 +1690,7 @@
 int VideoRenderDirectDraw::GetScreenResolution(int& screenWidth,
                                                    int& screenHeight)
 {
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
 
     screenWidth = _screenRect.right - _screenRect.left;
     screenHeight = _screenRect.bottom - _screenRect.top;
@@ -1699,7 +1699,7 @@
 
 int VideoRenderDirectDraw::UpdateSystemCPUUsage(int systemCPU)
 {
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
     if (systemCPU <= 100 && systemCPU >= 0)
     {
         _systemCPUUsage = systemCPU;
@@ -2395,7 +2395,7 @@
 DirectDrawChannel* VideoRenderDirectDraw::ShareDirectDrawChannel(
                                                                          int channel)
 {
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
 
     DirectDrawChannel* obj = NULL;
 
@@ -2411,7 +2411,7 @@
 
 WebRtc_Word32 VideoRenderDirectDraw::DeleteChannel(const WebRtc_UWord32 channel)
 {
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
 
     // Remove the old z order
 
@@ -2449,7 +2449,7 @@
                                                            float& stopWidth,
                                                            float& stopHeight)
 {
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
 
     std::map<int, DirectDrawChannel*>::iterator ddIt;
     ddIt = _directDrawChannels.find(channel & 0x0000ffff);
@@ -2488,7 +2488,7 @@
 
 int VideoRenderDirectDraw::GetChannels(std::list<int>& channelList)
 {
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
 
     std::map<int, DirectDrawChannel*>::iterator ddIt;
     ddIt = _directDrawChannels.begin();
@@ -2508,7 +2508,7 @@
 
 bool VideoRenderDirectDraw::HasChannel(int channel)
 {
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
 
     std::map<int, DirectDrawChannel*>::iterator ddIt;
     ddIt = _directDrawChannels.find(channel & 0x0000ffff);
@@ -2521,7 +2521,7 @@
 
 bool VideoRenderDirectDraw::HasChannels()
 {
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
 
     if (_directDrawChannels.begin() != _directDrawChannels.end())
     {
@@ -2552,7 +2552,7 @@
     // Only support one stream per channel, is demuxing done outside if DD.
     streamID = 0;
 
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
 
     if (!_canStretch)
     {
@@ -2625,7 +2625,7 @@
                                                      float left, float top,
                                                      float right, float bottom)
 {
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
     if (!_canStretch)
     {
         if (left != 0.0f || top != 0.0f || right != 1.0f || bottom != 1.0f)
@@ -2696,7 +2696,7 @@
 {
     DirectDrawTextSettings* textSetting = NULL;
 
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
 
     _frameChanged = true;
 
@@ -2784,7 +2784,7 @@
 {
     DirectDrawBitmapSettings* bitmapSetting = NULL;
 
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
 
     _frameChanged = true;
     std::map<unsigned char, DirectDrawBitmapSettings*>::iterator it;
@@ -2905,7 +2905,7 @@
 WebRtc_Word32 VideoRenderDirectDraw::SetTransparentBackground(
                                                                   const bool enable)
 {
-    CriticalSectionScoped cs(*_confCritSect);
+    CriticalSectionScoped cs(_confCritSect);
 
     if (_supportTransparency)
     {
diff --git a/src/modules/video_render/main/source/windows/video_render_windows_impl.cc b/src/modules/video_render/main/source/windows/video_render_windows_impl.cc
index 6f2237f..cdc74bb 100644
--- a/src/modules/video_render/main/source/windows/video_render_windows_impl.cc
+++ b/src/modules/video_render/main/source/windows/video_render_windows_impl.cc
@@ -99,14 +99,14 @@
 
 WebRtc_Word32 VideoRenderWindowsImpl::ChangeUniqueId(const WebRtc_Word32 id)
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     _id = id;
     return 0;
 }
 
 WebRtc_Word32 VideoRenderWindowsImpl::ChangeWindow(void* window)
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     if (!_ptrRendererWin)
     {
         return -1;
@@ -125,7 +125,7 @@
                                                 const float right,
                                                 const float bottom)
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     VideoRenderCallback* renderCallback = NULL;
 
     if (!_ptrRendererWin)
@@ -143,7 +143,7 @@
 WebRtc_Word32 VideoRenderWindowsImpl::DeleteIncomingRenderStream(
                                                                  const WebRtc_UWord32 streamId)
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     WebRtc_Word32 error = -1;
     if (!_ptrRendererWin)
     {
@@ -163,7 +163,7 @@
                                                                         float& right,
                                                                         float& bottom) const
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     zOrder = 0;
     left = 0;
     top = 0;
@@ -184,7 +184,7 @@
 
 WebRtc_Word32 VideoRenderWindowsImpl::StartRender()
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     WebRtc_Word32 error = -1;
     if (!_ptrRendererWin)
     {
@@ -198,7 +198,7 @@
 
 WebRtc_Word32 VideoRenderWindowsImpl::StopRender()
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     WebRtc_Word32 error = -1;
     if (!_ptrRendererWin)
     {
@@ -222,7 +222,7 @@
 
 bool VideoRenderWindowsImpl::FullScreen()
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     bool fullscreen = false;
     if (!_ptrRendererWin)
     {
@@ -253,7 +253,7 @@
                                                           WebRtc_UWord32& screenWidth,
                                                           WebRtc_UWord32& screenHeight) const
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     screenWidth = 0;
     screenHeight = 0;
     return 0;
@@ -262,7 +262,7 @@
 WebRtc_UWord32 VideoRenderWindowsImpl::RenderFrameRate(
                                                        const WebRtc_UWord32 streamId)
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     return 0;
 }
 
@@ -273,7 +273,7 @@
                                                         const float right,
                                                         const float bottom)
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     WebRtc_Word32 error = -1;
     if (!_ptrRendererWin)
     {
@@ -294,7 +294,7 @@
                                                         const float right,
                                                         const float bottom)
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     WebRtc_Word32 error = -1;
     if (!_ptrRendererWin)
     {
@@ -311,7 +311,7 @@
 WebRtc_Word32 VideoRenderWindowsImpl::SetTransparentBackground(
                                                                const bool enable)
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     WebRtc_Word32 error = -1;
     if (!_ptrRendererWin)
     {
@@ -334,7 +334,7 @@
                                               const float right,
                                               const float bottom)
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     WebRtc_Word32 error = -1;
     if (!_ptrRendererWin)
     {
@@ -356,7 +356,7 @@
                                                 const float right,
                                                 const float bottom)
 {
-    CriticalSectionScoped cs(_renderWindowsCritsect);
+    CriticalSectionScoped cs(&_renderWindowsCritsect);
     WebRtc_Word32 error = -1;
     if (!_ptrRendererWin)
     {