OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_FRAME_DELIVERER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_FRAME_DELIVERER_H_ |
6 #define CONTENT_RENDERER_MEDIA_VIDEO_FRAME_DELIVERER_H_ | 6 #define CONTENT_RENDERER_MEDIA_VIDEO_FRAME_DELIVERER_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/message_loop/message_loop_proxy.h" | 13 #include "base/message_loop/message_loop_proxy.h" |
14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
15 #include "content/common/media/video_capture.h" | 15 #include "content/common/media/video_capture.h" |
16 #include "media/base/video_frame.h" | 16 #include "media/base/video_frame.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 // VideoFrameDeliverer is a helper class used for registering | 20 // VideoFrameDeliverer is a helper class used for registering |
21 // VideoCaptureDeliverFrameCB on the main render thread to receive video frames | 21 // VideoCaptureDeliverFrameCB on the main render thread to receive video frames |
22 // on the IO-thread. | 22 // on the IO-thread. |
23 // Its used by MediaStreamVideoTrack and MediaStreamVideoSource. | 23 // Its used by MediaStreamVideoTrack. |
24 class VideoFrameDeliverer | 24 class VideoFrameDeliverer |
25 : public base::RefCountedThreadSafe<VideoFrameDeliverer> { | 25 : public base::RefCountedThreadSafe<VideoFrameDeliverer> { |
26 public: | 26 public: |
27 explicit VideoFrameDeliverer( | 27 explicit VideoFrameDeliverer( |
28 const scoped_refptr<base::MessageLoopProxy>& io_message_loop); | 28 const scoped_refptr<base::MessageLoopProxy>& io_message_loop); |
29 | 29 |
30 // Add |callback| to receive video frames on the IO-thread. | 30 // Add |callback| to receive video frames on the IO-thread. |
31 // Must be called on the main render thread. | 31 // Must be called on the main render thread. |
32 void AddCallback(void* id, const VideoCaptureDeliverFrameCB& callback); | 32 void AddCallback(void* id, const VideoCaptureDeliverFrameCB& callback); |
33 | 33 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 typedef std::pair<void*, VideoCaptureDeliverFrameCB> VideoIdCallbackPair; | 72 typedef std::pair<void*, VideoCaptureDeliverFrameCB> VideoIdCallbackPair; |
73 std::vector<VideoIdCallbackPair> callbacks_; | 73 std::vector<VideoIdCallbackPair> callbacks_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(VideoFrameDeliverer); | 75 DISALLOW_COPY_AND_ASSIGN(VideoFrameDeliverer); |
76 }; | 76 }; |
77 | 77 |
78 } // namespace content | 78 } // namespace content |
79 | 79 |
80 #endif // CONTENT_RENDERER_MEDIA_VIDEO_FRAME_DELIVERER_H_ | 80 #endif // CONTENT_RENDERER_MEDIA_VIDEO_FRAME_DELIVERER_H_ |
OLD | NEW |