Skip to content

Commit

Permalink
open camera with O_RDWR.
Browse files Browse the repository at this point in the history
This is somehow needed for Linux kernel 3.3 and above. If camera is opened with O_RDONLY, mmap will fail.
However, since we are not going to modify device memory, it should be allowed to open camera with O_RDONLY.

BUG=http://code.google.com/p/webrtc/issues/detail?id=512
Review URL: https://chromiumcodereview.appspot.com/10542080

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141308 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
wjia@chromium.org committed Jun 8, 2012
1 parent dd4267c commit 879d832
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion media/video/capture/linux/video_capture_device_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ void VideoCaptureDeviceLinux::OnAllocate(int width,

observer_ = observer;

if ((device_fd_ = open(device_name_.unique_id.c_str(), O_RDONLY)) < 0) {
// Need to open camera with O_RDWR after Linux kernel 3.3.
if ((device_fd_ = open(device_name_.unique_id.c_str(), O_RDWR)) < 0) {
SetErrorState("Failed to open V4L2 device driver.");
return;
}
Expand Down

0 comments on commit 879d832

Please sign in to comment.