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

Side by Side Diff: services/video_capture/device_client_mojo_to_media_adapter.cc

Issue 2238083004: Video Capture Mojo (1.4b): Implement ability to use fake device instance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FillServicePart1
Patch Set: Fix control reached end of non-void function. Created 4 years, 3 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 2016 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 "services/video_capture/device_client_mojo_to_media_adapter.h"
6 #include "media/mojo/common/media_type_converters.h"
7 #include "media/mojo/common/mojo_shared_buffer_video_frame.h"
8
9 namespace video_capture {
10
11 using Buffer = media::VideoCaptureDevice::Client::Buffer;
12
13 DeviceClientMojoToMediaAdapter::DeviceClientMojoToMediaAdapter(
14 mojom::VideoCaptureDeviceClientPtr client)
15 : client_(std::move(client)) {
16 const gfx::Size kDummyDimensions(640, 480);
17 const base::TimeDelta kDummyTimestamp;
18 dummy_frame_ = media::MojoSharedBufferVideoFrame::CreateDefaultI420(
19 kDummyDimensions, kDummyTimestamp);
20 }
21
22 DeviceClientMojoToMediaAdapter::~DeviceClientMojoToMediaAdapter() = default;
23
24 void DeviceClientMojoToMediaAdapter::OnIncomingCapturedData(
25 const uint8_t* data,
26 int length,
27 const VideoCaptureFormat& frame_format,
28 int clockwise_rotation,
29 base::TimeTicks reference_time,
30 base::TimeDelta timestamp) {
31 // TODO(chfremer): convert actual received frame data.
32 // Use dummy frame data for now.
33 // https://crbug.com/584797
34 auto video_frame_ptr =
35 media::mojom::VideoFrame::From<scoped_refptr<media::VideoFrame>>(
36 dummy_frame_);
37
38 client_->OnFrameAvailable(std::move(video_frame_ptr));
39 }
40
41 std::unique_ptr<Buffer> DeviceClientMojoToMediaAdapter::ReserveOutputBuffer(
42 const gfx::Size& dimensions,
43 VideoPixelFormat format,
44 VideoPixelStorage storage) {
45 NOTIMPLEMENTED();
46 return nullptr;
47 }
48
49 void DeviceClientMojoToMediaAdapter::OnIncomingCapturedBuffer(
50 std::unique_ptr<Buffer> buffer,
51 const VideoCaptureFormat& frame_format,
52 base::TimeTicks reference_time,
53 base::TimeDelta timestamp) {
54 NOTIMPLEMENTED();
55 }
56
57 void DeviceClientMojoToMediaAdapter::OnIncomingCapturedVideoFrame(
58 std::unique_ptr<Buffer> buffer,
59 const scoped_refptr<VideoFrame>& frame) {
60 auto video_frame_ptr = media::mojom::VideoFrame::From(frame);
61 client_->OnFrameAvailable(std::move(video_frame_ptr));
62 }
63
64 std::unique_ptr<Buffer>
65 DeviceClientMojoToMediaAdapter::ResurrectLastOutputBuffer(
66 const gfx::Size& dimensions,
67 VideoPixelFormat format,
68 VideoPixelStorage storage) {
69 NOTIMPLEMENTED();
70 return nullptr;
71 }
72
73 void DeviceClientMojoToMediaAdapter::OnError(
74 const tracked_objects::Location& from_here,
75 const std::string& reason) {
76 NOTIMPLEMENTED();
77 }
78
79 double DeviceClientMojoToMediaAdapter::GetBufferPoolUtilization() const {
80 NOTIMPLEMENTED();
81 return 0.0;
82 }
83
84 } // namespace video_capture
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698