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

Unified Diff: media/capture/video/video_frame_receiver_on_task_runner.cc

Issue 2795663002: Change VideoFrameReceiverOnIOThread to VideoFrameReceiverOnTaskRunner (Closed)
Patch Set: Rebase Created 3 years, 8 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
« no previous file with comments | « media/capture/video/video_frame_receiver_on_task_runner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/video/video_frame_receiver_on_task_runner.cc
diff --git a/media/capture/video/video_frame_receiver_on_task_runner.cc b/media/capture/video/video_frame_receiver_on_task_runner.cc
new file mode 100644
index 0000000000000000000000000000000000000000..da8cf8f8df71e134ee8c311b49acfc5000342657
--- /dev/null
+++ b/media/capture/video/video_frame_receiver_on_task_runner.cc
@@ -0,0 +1,68 @@
+// Copyright 2017 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 "media/capture/video/video_frame_receiver_on_task_runner.h"
+
+#include "base/single_thread_task_runner.h"
+
+namespace media {
+
+VideoFrameReceiverOnTaskRunner::VideoFrameReceiverOnTaskRunner(
+ const base::WeakPtr<VideoFrameReceiver>& receiver,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner)
+ : receiver_(receiver), task_runner_(std::move(task_runner)) {}
+
+VideoFrameReceiverOnTaskRunner::~VideoFrameReceiverOnTaskRunner() = default;
+
+void VideoFrameReceiverOnTaskRunner::OnNewBufferHandle(
+ int buffer_id,
+ std::unique_ptr<VideoCaptureDevice::Client::Buffer::HandleProvider>
+ handle_provider) {
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&VideoFrameReceiver::OnNewBufferHandle, receiver_, buffer_id,
+ base::Passed(std::move(handle_provider))));
+}
+
+void VideoFrameReceiverOnTaskRunner::OnFrameReadyInBuffer(
+ int buffer_id,
+ int frame_feedback_id,
+ std::unique_ptr<VideoCaptureDevice::Client::Buffer::ScopedAccessPermission>
+ buffer_read_permission,
+ mojom::VideoFrameInfoPtr frame_info) {
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&VideoFrameReceiver::OnFrameReadyInBuffer,
+ receiver_, buffer_id, frame_feedback_id,
+ base::Passed(&buffer_read_permission),
+ base::Passed(&frame_info)));
+}
+
+void VideoFrameReceiverOnTaskRunner::OnBufferRetired(int buffer_id) {
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&VideoFrameReceiver::OnBufferRetired, receiver_, buffer_id));
+}
+
+void VideoFrameReceiverOnTaskRunner::OnError() {
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&VideoFrameReceiver::OnError, receiver_));
+}
+
+void VideoFrameReceiverOnTaskRunner::OnLog(const std::string& message) {
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(&VideoFrameReceiver::OnLog, receiver_, message));
+}
+
+void VideoFrameReceiverOnTaskRunner::OnStarted() {
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&VideoFrameReceiver::OnStarted, receiver_));
+}
+
+void VideoFrameReceiverOnTaskRunner::OnStartedUsingGpuDecode() {
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&VideoFrameReceiver::OnStartedUsingGpuDecode, receiver_));
+}
+
+} // namespace media
« no previous file with comments | « media/capture/video/video_frame_receiver_on_task_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698