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

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

Issue 2795663002: Change VideoFrameReceiverOnIOThread to VideoFrameReceiverOnTaskRunner (Closed)
Patch Set: Created 3 years, 9 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: 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..99690636ae2146197726d736912228ff36137544
--- /dev/null
+++ b/media/capture/video/video_frame_receiver_on_task_runner.cc
@@ -0,0 +1,60 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
mcasas 2017/04/03 17:14:23 s/2016/2017/
Chandan 2017/04/04 07:27:09 Done.
+// 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"
+
+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_));
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698