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

Unified Diff: services/video_capture/receiver_mojo_to_media_adapter.cc

Issue 2378943002: Let clients interact with VideoCaptureDeviceClient instead of VideoCaptureDevice (Closed)
Patch Set: Remove method AsClientBuffer() Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: services/video_capture/receiver_mojo_to_media_adapter.cc
diff --git a/services/video_capture/receiver_mojo_to_media_adapter.cc b/services/video_capture/receiver_mojo_to_media_adapter.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cc06ab53d4f733d5f9bb1c1a35b0581bbf058363
--- /dev/null
+++ b/services/video_capture/receiver_mojo_to_media_adapter.cc
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "services/video_capture/receiver_mojo_to_media_adapter.h"
+
+#include "media/mojo/common/media_type_converters.h"
+#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
+
+namespace video_capture {
+
+ReceiverMojoToMediaAdapter::ReceiverMojoToMediaAdapter(
+ mojom::VideoFrameReceiverPtr receiver)
+ : receiver_(std::move(receiver)) {}
+
+ReceiverMojoToMediaAdapter::~ReceiverMojoToMediaAdapter() = default;
+
+void ReceiverMojoToMediaAdapter::OnIncomingCapturedVideoFrame(
+ std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer,
+ const scoped_refptr<media::VideoFrame>& frame) {
+ // O: |frame| should already be backed by a MojoSharedBufferVideoFrame
+ // assuming we have used the correct buffer factory with the pool.
+ auto video_frame_ptr = media::mojom::VideoFrame::From(frame);
+ receiver_->OnIncomingCapturedVideoFrame(std::move(video_frame_ptr));
+}
+
+void ReceiverMojoToMediaAdapter::OnError() {
+ receiver_->OnError();
+}
+
+void ReceiverMojoToMediaAdapter::OnLog(const std::string& message) {
+ receiver_->OnLog(message);
+}
+
+void ReceiverMojoToMediaAdapter::OnBufferDestroyed(int buffer_id_to_drop) {
+ // Nothing to do here.
+ // This call is only needed for clients who need to explicitly share buffers
+ // with other processes and keep track of which buffers the buffer pool is
+ // no longer going to reuse/resurrect.
+ // In the world of Mojo, we do not need to share buffers explicitly.
+}
+
+} // namespace video_capture
« no previous file with comments | « services/video_capture/receiver_mojo_to_media_adapter.h ('k') | services/video_capture/video_capture_device_factory_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698