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

Side by Side Diff: content/renderer/media/video_frame_deliverer.h

Issue 287313002: Pass a TimeTicks along video capture pipeline to represent capture time (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged and land Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/public/renderer/media_stream_video_sink.h"
16 #include "media/base/video_frame.h" 17 #include "media/base/video_frame.h"
17 18
18 namespace content { 19 namespace content {
19 20
20 // VideoFrameDeliverer is a helper class used for registering 21 // VideoFrameDeliverer is a helper class used for registering
21 // VideoCaptureDeliverFrameCB on the main render thread to receive video frames 22 // VideoCaptureDeliverFrameCB on the main render thread to receive video frames
22 // on the IO-thread. 23 // on the IO-thread.
23 // Its used by MediaStreamVideoTrack. 24 // Its used by MediaStreamVideoTrack.
24 class VideoFrameDeliverer 25 class VideoFrameDeliverer
25 : public base::RefCountedThreadSafe<VideoFrameDeliverer> { 26 : public base::RefCountedThreadSafe<VideoFrameDeliverer> {
26 public: 27 public:
27 explicit VideoFrameDeliverer( 28 explicit VideoFrameDeliverer(
28 const scoped_refptr<base::MessageLoopProxy>& io_message_loop); 29 const scoped_refptr<base::MessageLoopProxy>& io_message_loop);
29 30
30 // Add |callback| to receive video frames on the IO-thread. 31 // Add |callback| to receive video frames on the IO-thread.
31 // Must be called on the main render thread. 32 // Must be called on the main render thread.
32 void AddCallback(void* id, const VideoCaptureDeliverFrameCB& callback); 33 void AddCallback(void* id, const VideoCaptureDeliverFrameCB& callback);
33 34
34 // Removes |callback| associated with |id| from receiving video frames if |id| 35 // 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 36 // 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. 37 // been added. Note that the added callback will be reset on the main thread.
37 // Must be called on the main render thread. 38 // Must be called on the main render thread.
38 void RemoveCallback(void* id); 39 void RemoveCallback(void* id);
39 40
40 // Triggers all registered callbacks with |frame| and |format| as parameters. 41 // Triggers all registered callbacks with |frame|, |format| and
41 // Must be called on the IO-thread. 42 // |estimated_capture_time| as parameters. Must be called on the IO-thread.
42 virtual void DeliverFrameOnIO( 43 virtual void DeliverFrameOnIO(
43 const scoped_refptr<media::VideoFrame>& frame, 44 const scoped_refptr<media::VideoFrame>& frame,
44 const media::VideoCaptureFormat& format); 45 const media::VideoCaptureFormat& format,
46 const base::TimeTicks& estimated_capture_time);
45 47
46 const scoped_refptr<base::MessageLoopProxy>& io_message_loop() const { 48 const scoped_refptr<base::MessageLoopProxy>& io_message_loop() const {
47 return io_message_loop_; 49 return io_message_loop_;
48 } 50 }
49 51
50 protected: 52 protected:
51 void AddCallbackOnIO(void* id, const VideoCaptureDeliverFrameCB& callback); 53 void AddCallbackOnIO(void* id, const VideoCaptureDeliverFrameCB& callback);
52 54
53 // Callback will be removed and then reset on the designated message loop. 55 // 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. 56 // It is ok to call RemoveCallback even if |id| has not been added.
(...skipping 16 matching lines...) Expand all
71 73
72 typedef std::pair<void*, VideoCaptureDeliverFrameCB> VideoIdCallbackPair; 74 typedef std::pair<void*, VideoCaptureDeliverFrameCB> VideoIdCallbackPair;
73 std::vector<VideoIdCallbackPair> callbacks_; 75 std::vector<VideoIdCallbackPair> callbacks_;
74 76
75 DISALLOW_COPY_AND_ASSIGN(VideoFrameDeliverer); 77 DISALLOW_COPY_AND_ASSIGN(VideoFrameDeliverer);
76 }; 78 };
77 79
78 } // namespace content 80 } // namespace content
79 81
80 #endif // CONTENT_RENDERER_MEDIA_VIDEO_FRAME_DELIVERER_H_ 82 #endif // CONTENT_RENDERER_MEDIA_VIDEO_FRAME_DELIVERER_H_
OLDNEW
« no previous file with comments | « content/renderer/media/video_capture_impl_unittest.cc ('k') | content/renderer/media/video_frame_deliverer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698