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

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: Created 4 years, 4 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: convert actual received frame data.
32 // Use dummy frame data for now.
33 auto video_frame_ptr =
34 media::mojom::VideoFrame::From<scoped_refptr<media::VideoFrame>>(
35 dummy_frame_);
36
37 client_->OnFrameAvailable(std::move(video_frame_ptr));
38 }
39
40 std::unique_ptr<Buffer> DeviceClientMojoToMediaAdapter::ReserveOutputBuffer(
41 const gfx::Size& dimensions,
42 VideoPixelFormat format,
43 VideoPixelStorage storage) {
44 NOTIMPLEMENTED();
45 return nullptr;
46 }
47
48 void DeviceClientMojoToMediaAdapter::OnIncomingCapturedBuffer(
49 std::unique_ptr<Buffer> buffer,
50 const VideoCaptureFormat& frame_format,
51 base::TimeTicks reference_time,
52 base::TimeDelta timestamp) {
53 NOTIMPLEMENTED();
54 }
55
56 void DeviceClientMojoToMediaAdapter::OnIncomingCapturedVideoFrame(
57 std::unique_ptr<Buffer> buffer,
58 const scoped_refptr<VideoFrame>& frame) {
59 auto video_frame_ptr = media::mojom::VideoFrame::From(frame);
60 client_->OnFrameAvailable(std::move(video_frame_ptr));
61 }
62
63 std::unique_ptr<Buffer>
64 DeviceClientMojoToMediaAdapter::ResurrectLastOutputBuffer(
65 const gfx::Size& dimensions,
66 VideoPixelFormat format,
67 VideoPixelStorage storage) {
68 NOTIMPLEMENTED();
69 return nullptr;
70 }
71
72 void DeviceClientMojoToMediaAdapter::OnError(
73 const tracked_objects::Location& from_here,
74 const std::string& reason) {
75 NOTIMPLEMENTED();
76 }
77
78 double DeviceClientMojoToMediaAdapter::GetBufferPoolUtilization() const {
79 NOTIMPLEMENTED();
80 return 0.0;
81 }
82
83 } // namespace video_capture
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698