Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: media/video/capture/linux/video_capture_device_chromeos.cc

Issue 320483002: Check that capture_device_ is valid before setting the rotation on it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "media/video/capture/linux/video_capture_device_chromeos.h" 5 #include "media/video/capture/linux/video_capture_device_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "ui/gfx/display.h" 10 #include "ui/gfx/display.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void SendDisplayRotation(const gfx::Display& display) { 75 void SendDisplayRotation(const gfx::Display& display) {
76 DCHECK(capture_task_runner_->BelongsToCurrentThread()); 76 DCHECK(capture_task_runner_->BelongsToCurrentThread());
77 capture_task_runner_->PostTask( 77 capture_task_runner_->PostTask(
78 FROM_HERE, 78 FROM_HERE,
79 base::Bind(&ScreenObserverDelegate::SendDisplayRotationOnCaptureThread, 79 base::Bind(&ScreenObserverDelegate::SendDisplayRotationOnCaptureThread,
80 this, display)); 80 this, display));
81 } 81 }
82 82
83 void SendDisplayRotationOnCaptureThread(const gfx::Display& display) { 83 void SendDisplayRotationOnCaptureThread(const gfx::Display& display) {
84 DCHECK(capture_task_runner_->BelongsToCurrentThread()); 84 DCHECK(capture_task_runner_->BelongsToCurrentThread());
85 capture_device_->SetDisplayRotation(display); 85 if (capture_device_)
86 capture_device_->SetDisplayRotation(display);
86 } 87 }
87 88
88 VideoCaptureDeviceChromeOS* capture_device_; 89 VideoCaptureDeviceChromeOS* capture_device_;
89 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; 90 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
90 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; 91 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_;
91 DISALLOW_IMPLICIT_CONSTRUCTORS(ScreenObserverDelegate); 92 DISALLOW_IMPLICIT_CONSTRUCTORS(ScreenObserverDelegate);
92 }; 93 };
93 94
94 95
95 VideoCaptureDeviceChromeOS::VideoCaptureDeviceChromeOS( 96 VideoCaptureDeviceChromeOS::VideoCaptureDeviceChromeOS(
96 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 97 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
97 const Name& device_name) 98 const Name& device_name)
98 : VideoCaptureDeviceLinux(device_name), 99 : VideoCaptureDeviceLinux(device_name),
99 screen_observer_delegate_(new ScreenObserverDelegate(this, 100 screen_observer_delegate_(new ScreenObserverDelegate(this,
100 ui_task_runner)) { 101 ui_task_runner)) {
101 } 102 }
102 103
103 VideoCaptureDeviceChromeOS::~VideoCaptureDeviceChromeOS() { 104 VideoCaptureDeviceChromeOS::~VideoCaptureDeviceChromeOS() {
104 screen_observer_delegate_->RemoveObserver(); 105 screen_observer_delegate_->RemoveObserver();
105 } 106 }
106 107
107 void VideoCaptureDeviceChromeOS::SetDisplayRotation( 108 void VideoCaptureDeviceChromeOS::SetDisplayRotation(
108 const gfx::Display& display) { 109 const gfx::Display& display) {
109 if (display.IsInternal()) 110 if (display.IsInternal())
110 SetRotation(display.rotation() * 90); 111 SetRotation(display.rotation() * 90);
111 } 112 }
112 113
113 } // namespace media 114 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698