OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/video_frame_capturer.h" | 5 #include "remoting/host/video_frame_capturer.h" |
6 | 6 |
7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 #include <Cocoa/Cocoa.h> | 8 #include <Cocoa/Cocoa.h> |
9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
10 #include <IOKit/pwr_mgt/IOPMLib.h> | 10 #include <IOKit/pwr_mgt/IOPMLib.h> |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 : cgl_context_(NULL), | 61 : cgl_context_(NULL), |
62 pixel_buffer_object_(0) { | 62 pixel_buffer_object_(0) { |
63 } | 63 } |
64 | 64 |
65 scoped_pixel_buffer_object::~scoped_pixel_buffer_object() { | 65 scoped_pixel_buffer_object::~scoped_pixel_buffer_object() { |
66 Release(); | 66 Release(); |
67 } | 67 } |
68 | 68 |
69 bool scoped_pixel_buffer_object::Init(CGLContextObj cgl_context, | 69 bool scoped_pixel_buffer_object::Init(CGLContextObj cgl_context, |
70 int size_in_bytes) { | 70 int size_in_bytes) { |
71 // The PBO path is only done on 10.6 (SnowLeopard) and above due to | |
72 // a driver issue that was found on 10.5 | |
73 // (specifically on a NVIDIA GeForce 7300 GT). | |
74 // http://crbug.com/87283 | |
75 if (base::mac::IsOSLeopardOrEarlier()) { | |
76 return false; | |
77 } | |
78 cgl_context_ = cgl_context; | 71 cgl_context_ = cgl_context; |
79 CGLContextObj CGL_MACRO_CONTEXT = cgl_context_; | 72 CGLContextObj CGL_MACRO_CONTEXT = cgl_context_; |
80 glGenBuffersARB(1, &pixel_buffer_object_); | 73 glGenBuffersARB(1, &pixel_buffer_object_); |
81 if (glGetError() == GL_NO_ERROR) { | 74 if (glGetError() == GL_NO_ERROR) { |
82 glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pixel_buffer_object_); | 75 glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pixel_buffer_object_); |
83 glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, size_in_bytes, NULL, | 76 glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, size_in_bytes, NULL, |
84 GL_STREAM_READ_ARB); | 77 GL_STREAM_READ_ARB); |
85 glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0); | 78 glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0); |
86 if (glGetError() != GL_NO_ERROR) { | 79 if (glGetError() != GL_NO_ERROR) { |
87 Release(); | 80 Release(); |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 VideoFrameCapturer* VideoFrameCapturer::Create() { | 764 VideoFrameCapturer* VideoFrameCapturer::Create() { |
772 VideoFrameCapturerMac* capturer = new VideoFrameCapturerMac(); | 765 VideoFrameCapturerMac* capturer = new VideoFrameCapturerMac(); |
773 if (!capturer->Init()) { | 766 if (!capturer->Init()) { |
774 delete capturer; | 767 delete capturer; |
775 capturer = NULL; | 768 capturer = NULL; |
776 } | 769 } |
777 return capturer; | 770 return capturer; |
778 } | 771 } |
779 | 772 |
780 } // namespace remoting | 773 } // namespace remoting |
OLD | NEW |