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

Side by Side Diff: media/capture/video/chromeos/camera_device_context.cc

Issue 2837273004: media: add video capture device for ARC++ camera HAL v3 (Closed)
Patch Set: address chfremer's comments Created 3 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/capture/video/chromeos/camera_device_context.h"
6
7 namespace media {
8
9 CameraDeviceContext::CameraDeviceContext(
10 std::unique_ptr<VideoCaptureDevice::Client> client)
11 : state_(kStopped), rotation_(0), client_(std::move(client)) {}
12
13 void CameraDeviceContext::SetState(State state) {
14 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
15 state_ = state;
16 if (state_ == kCapturing) {
17 client_->OnStarted();
18 }
19 }
20
21 CameraDeviceContext::State CameraDeviceContext::GetState() {
22 return state_;
23 }
24
25 void CameraDeviceContext::SetErrorState(
26 const tracked_objects::Location& from_here,
27 const std::string& reason) {
28 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
29 state_ = kError;
30 LOG(ERROR) << reason;
31 client_->OnError(from_here, reason);
32 }
33
34 void CameraDeviceContext::LogToClient(std::string message) {
35 if (client_) {
36 client_->OnLog(message);
37 }
38 }
39
40 void CameraDeviceContext::SubmitCapturedData(
41 const uint8_t* data,
42 int length,
43 const VideoCaptureFormat& frame_format,
44 base::TimeTicks reference_time,
45 base::TimeDelta timestamp) {
46 if (client_) {
47 client_->OnIncomingCapturedData(data, length, frame_format, rotation_,
48 reference_time, timestamp);
49 }
50 }
51
52 void CameraDeviceContext::SetRotation(int rotation) {
53 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
54 DCHECK(rotation >= 0 && rotation < 360 && rotation % 90 == 0);
55 rotation_ = rotation;
56 }
57
58 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698