Fix crash in the window capturer on windows
BUG=crbug.com/289753 R=wez@chromium.org Review URL: https://webrtc-codereview.appspot.com/2203005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4737 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
7959e16cc2
commit
6a5cc9d899
@ -10,6 +10,8 @@
|
||||
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame_win.h"
|
||||
|
||||
#include "webrtc/system_wrappers/interface/logging.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
DesktopFrameWin::DesktopFrameWin(DesktopSize size,
|
||||
@ -48,6 +50,7 @@ DesktopFrameWin* DesktopFrameWin::Create(DesktopSize size,
|
||||
HBITMAP bitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &data,
|
||||
section_handle, 0);
|
||||
if (!bitmap) {
|
||||
LOG(LS_WARNING) << "Failed to allocate new window frame " << GetLastError();
|
||||
delete shared_memory;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -189,6 +189,10 @@ void WindowCapturerWin::Capture(const DesktopRegion& region) {
|
||||
scoped_ptr<DesktopFrameWin> frame(DesktopFrameWin::Create(
|
||||
DesktopSize(rect.right - rect.left, rect.bottom - rect.top),
|
||||
NULL, window_dc_));
|
||||
if (!frame.get()) {
|
||||
callback_->OnCaptureCompleted(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
HDC mem_dc = CreateCompatibleDC(window_dc_);
|
||||
SelectObject(mem_dc, frame->bitmap());
|
||||
|
Loading…
x
Reference in New Issue
Block a user