| 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 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 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 |
| 34 // Removes |callback| associated with |id| from receiving video frames if |id| | 34 // Removes |callback| associated with |id| from receiving video frames if |id| |
| 35 // has been added. It is ok to call RemoveCallback even if the |id| has not | 35 // has been added. It is ok to call RemoveCallback even if the |id| has not |
| 36 // been added. Note that the added callback will be reset on the main thread. | 36 // been added. Note that the added callback will be reset on the main thread. |
| 37 // Must be called on the main render thread. | 37 // Must be called on the main render thread. |
| 38 void RemoveCallback(void* id); | 38 void RemoveCallback(void* id); |
| 39 | 39 |
| 40 // Triggers all registered callbacks with |frame| and |format| as parameters. | 40 // Triggers all registered callbacks with |frame|, |format| and |start_ticks| |
| 41 // Must be called on the IO-thread. | 41 // as parameters. Must be called on the IO-thread. |
| 42 virtual void DeliverFrameOnIO( | 42 virtual void DeliverFrameOnIO( |
| 43 const scoped_refptr<media::VideoFrame>& frame, | 43 const scoped_refptr<media::VideoFrame>& frame, |
| 44 const media::VideoCaptureFormat& format); | 44 const media::VideoCaptureFormat& format, |
| 45 const base::TimeTicks& start_ticks); |
| 45 | 46 |
| 46 const scoped_refptr<base::MessageLoopProxy>& io_message_loop() const { | 47 const scoped_refptr<base::MessageLoopProxy>& io_message_loop() const { |
| 47 return io_message_loop_; | 48 return io_message_loop_; |
| 48 } | 49 } |
| 49 | 50 |
| 50 protected: | 51 protected: |
| 51 void AddCallbackOnIO(void* id, const VideoCaptureDeliverFrameCB& callback); | 52 void AddCallbackOnIO(void* id, const VideoCaptureDeliverFrameCB& callback); |
| 52 | 53 |
| 53 // Callback will be removed and then reset on the designated message loop. | 54 // Callback will be removed and then reset on the designated message loop. |
| 54 // It is ok to call RemoveCallback even if |id| has not been added. | 55 // It is ok to call RemoveCallback even if |id| has not been added. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 71 | 72 |
| 72 typedef std::pair<void*, VideoCaptureDeliverFrameCB> VideoIdCallbackPair; | 73 typedef std::pair<void*, VideoCaptureDeliverFrameCB> VideoIdCallbackPair; |
| 73 std::vector<VideoIdCallbackPair> callbacks_; | 74 std::vector<VideoIdCallbackPair> callbacks_; |
| 74 | 75 |
| 75 DISALLOW_COPY_AND_ASSIGN(VideoFrameDeliverer); | 76 DISALLOW_COPY_AND_ASSIGN(VideoFrameDeliverer); |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 } // namespace content | 79 } // namespace content |
| 79 | 80 |
| 80 #endif // CONTENT_RENDERER_MEDIA_VIDEO_FRAME_DELIVERER_H_ | 81 #endif // CONTENT_RENDERER_MEDIA_VIDEO_FRAME_DELIVERER_H_ |
| OLD | NEW |