OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ |
6 #define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ | 6 #define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "content/public/renderer/media_stream_sink.h" | 13 #include "content/public/renderer/media_stream_sink.h" |
| 14 #include "media/base/video_capturer_source.h" |
14 | 15 |
15 namespace media { | 16 namespace media { |
16 class VideoCaptureFormat; | 17 class VideoCaptureFormat; |
17 class VideoFrame; | 18 class VideoFrame; |
18 } | 19 } |
19 | 20 |
20 namespace blink { | 21 namespace blink { |
21 class WebMediaStreamTrack; | 22 class WebMediaStreamTrack; |
22 } | 23 } |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 | 26 |
26 // This callback is used to deliver video frames. | 27 typedef media::VideoCapturerSource::VideoCaptureDeliverFrameCB |
27 // | |
28 // |estimated_capture_time| - The capture time of the delivered video | |
29 // frame. This field represents the local time at which either: 1) the frame was | |
30 // generated, if it was done so locally; or 2) the targeted play-out time of the | |
31 // frame, if it was generated from a remote source. Either way, an | |
32 // implementation should not present the frame before this point-in-time. This | |
33 // value is NOT a high-resolution timestamp, and so it should not be used as a | |
34 // presentation time; but, instead, it should be used for buffering playback and | |
35 // for A/V synchronization purposes. NOTE: It is possible for this value to be | |
36 // null if the current implementation lacks this timing information. | |
37 // | |
38 // |video_frame->timestamp()| gives the presentation timestamp of the video | |
39 // frame relative to the first frame generated by the corresponding source. | |
40 // Because a source can start generating frames before a subscriber is added, | |
41 // the first video frame delivered may not have timestamp equal to 0. | |
42 typedef base::Callback< | |
43 void(const scoped_refptr<media::VideoFrame>& video_frame, | |
44 const media::VideoCaptureFormat& format, | |
45 const base::TimeTicks& estimated_capture_time)> | |
46 VideoCaptureDeliverFrameCB; | 28 VideoCaptureDeliverFrameCB; |
47 | 29 |
48 // MediaStreamVideoSink is an interface used for receiving video frames from a | 30 // MediaStreamVideoSink is an interface used for receiving video frames from a |
49 // Video Stream Track or a Video Source. | 31 // Video Stream Track or a Video Source. |
50 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html | 32 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html |
51 // All methods calls will be done from the main render thread. | 33 // All methods calls will be done from the main render thread. |
52 class CONTENT_EXPORT MediaStreamVideoSink : public MediaStreamSink { | 34 class CONTENT_EXPORT MediaStreamVideoSink : public MediaStreamSink { |
53 public: | 35 public: |
54 // An implementation of MediaStreamVideoSink should call AddToVideoTrack when | 36 // An implementation of MediaStreamVideoSink should call AddToVideoTrack when |
55 // it is ready to receive data from a video track. Before the implementation | 37 // it is ready to receive data from a video track. Before the implementation |
(...skipping 12 matching lines...) Expand all Loading... |
68 const blink::WebMediaStreamTrack& track); | 50 const blink::WebMediaStreamTrack& track); |
69 | 51 |
70 protected: | 52 protected: |
71 ~MediaStreamVideoSink() override {} | 53 ~MediaStreamVideoSink() override {} |
72 }; | 54 }; |
73 | 55 |
74 | 56 |
75 } // namespace content | 57 } // namespace content |
76 | 58 |
77 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ | 59 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_VIDEO_SINK_H_ |
OLD | NEW |