Index: media/capture/video/video_frame_receiver_on_task_runner.h |
diff --git a/media/capture/video/video_frame_receiver_on_task_runner.h b/media/capture/video/video_frame_receiver_on_task_runner.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7c42e6848dc4f7a5cf20e0e0cf00ea1c963c6fc6 |
--- /dev/null |
+++ b/media/capture/video/video_frame_receiver_on_task_runner.h |
@@ -0,0 +1,46 @@ |
+// 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. |
+ |
+#ifndef MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_ON_TASK_RUNNER_H_ |
+#define MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_ON_TASK_RUNNER_H_ |
+ |
+#include "base/single_thread_task_runner.h" |
mcasas
2017/04/03 17:14:23
Forward declare SingleThreadTaskRunner:
namespace
Chandan
2017/04/04 07:27:09
Done.
|
+#include "media/capture/video/video_frame_receiver.h" |
+ |
+namespace media { |
+ |
+// Decorator for VideoFrameReceiver that forwards all incoming calls to the |
+// specified thread. |
chfremer
2017/04/03 16:27:02
nit: We can make this more concrete by saying "...
Chandan
2017/04/04 07:27:09
Done.
|
+class CAPTURE_EXPORT VideoFrameReceiverOnTaskRunner |
+ : public VideoFrameReceiver { |
+ public: |
+ explicit VideoFrameReceiverOnTaskRunner( |
+ const base::WeakPtr<VideoFrameReceiver>& receiver, |
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
+ ~VideoFrameReceiverOnTaskRunner() override; |
+ |
+ void OnNewBufferHandle( |
+ int buffer_id, |
+ std::unique_ptr<VideoCaptureDevice::Client::Buffer::HandleProvider> |
+ handle_provider) override; |
+ void OnFrameReadyInBuffer( |
+ int buffer_id, |
+ int frame_feedback_id, |
+ std::unique_ptr< |
+ VideoCaptureDevice::Client::Buffer::ScopedAccessPermission> |
+ buffer_read_permission, |
+ mojom::VideoFrameInfoPtr frame_info) override; |
+ void OnBufferRetired(int buffer_id) override; |
+ void OnError() override; |
+ void OnLog(const std::string& message) override; |
+ void OnStarted() override; |
+ |
+ private: |
+ base::WeakPtr<VideoFrameReceiver> receiver_; |
mcasas
2017/04/03 17:14:24
Can be made const?
Chandan
2017/04/04 07:27:09
Done.
|
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
mcasas
2017/04/03 17:14:24
const.
Chandan
2017/04/04 07:27:09
Done.
|
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_ON_TASK_RUNNER_H_ |