OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef PPAPI_CPP_MEDIA_STREAM_VIDEO_TRACK_H_ | |
6 #define PPAPI_CPP_MEDIA_STREAM_VIDEO_TRACK_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "ppapi/c/pp_stdint.h" | |
11 #include "ppapi/cpp/resource.h" | |
12 | |
13 /// @file | |
14 /// This file defines the <code>MediaStreamTrackVideo</code> interface for a | |
yzshen1
2013/12/20 23:37:43
TrackVideo -> VideoTrack.
Peng
2013/12/23 02:41:49
Done.
| |
15 /// video source resource, which receives video frames from a MediaStream video | |
16 /// track in the browser. | |
17 | |
18 namespace pp { | |
19 | |
20 class VideoFrame; | |
21 template <typename T> class CompletionCallbackWithOutput; | |
22 | |
23 /// The <code>MediaStreamVideoTrack</code> class contains methods for | |
24 /// receiving video frames from a MediaStream video track in the browser. | |
25 class MediaStreamVideoTrack : public Resource { | |
26 public: | |
27 /// Default constructor for creating an is_null() | |
28 /// <code>MediaStreamVideoTrack</code> object. | |
29 MediaStreamVideoTrack(); | |
30 | |
31 /// A constructor used when you have received a <code>PP_Resource</code> as a | |
32 /// return value that has had 1 ref added for you. | |
33 /// | |
34 /// @param[in] resource A <code>PPB_ MediaStreamVideoTrack</code> resource. | |
yzshen1
2013/12/20 23:37:43
extra space after PPB_
Peng
2013/12/23 02:41:49
Done.
| |
35 MediaStreamVideoTrack(PassRef, PP_Resource resource); | |
36 | |
37 /// The destructor. | |
yzshen1
2013/12/20 23:37:43
This comment seems useless. :) Maybe we could remo
Peng
2013/12/23 02:41:49
Done.
| |
38 ~MediaStreamVideoTrack(); | |
39 | |
40 /// Configure underlayer frame buffers for incoming frames. The provided | |
yzshen1
2013/12/20 23:37:43
Please update the comments to match the C API comm
Peng
2013/12/23 02:41:49
Done.
| |
41 /// |frame_buffer_size| is provided in terms of the number of frames to use | |
42 /// for incoming frames. Should not be less than 1. If the application doesn't | |
43 /// want to drop frames, then the |frame_buffer_size| should be chosen such | |
44 /// that inter-frame processing time variability won't overrun the ring | |
45 /// buffer. If the buffer is overfilled, then frames will be dropped. | |
46 /// The application can detect this by examining the timestamp on returned | |
47 /// frames. | |
48 /// If |Configure()| is not used, default settings will be used. | |
49 int32_t Configure(uint32_t frame_buffer_size); | |
50 | |
51 /// Returns the ID of this track. | |
52 std::string GetId() const; | |
53 | |
54 /// Returns true if the track has ended. | |
55 bool HasEnded() const; | |
56 | |
57 /// This async call will notify the given CompletionCallback when | |
58 /// the next frame is delivered on the video track. Note that if internal | |
59 /// processing is slower than the incoming frame rate, frames will be | |
60 /// dropped from the incoming stream. Once the input buffer is full, | |
61 /// frames will be dropped until |ReuseFrame()| is called to free a spot for | |
62 /// another frame to be buffered. | |
63 /// | |
64 /// @param[in] cc A CompletionCallback which will receive the next | |
65 /// VideoFrame in the track. | |
66 /// | |
67 /// @return An int32_t containing a result code from <code>pp_errors.h</code>. | |
68 /// Returns PP_ERROR_BADRESOURCE if resource isn't a valid video source. | |
69 /// Returns PP_ERROR_NOMEMORY if |frame_buffer_size| frames buffer was not | |
70 /// allocated successfully. | |
71 /// Returns PP_ERROR_FAILED if the source is not open, or if some other | |
72 /// browser error occurs. | |
73 int32_t GetFrame( | |
74 const CompletionCallbackWithOutput<VideoFrame>& cc); | |
75 | |
76 /// Release a frame got from |GetFrame()|, so the track can reuse it for | |
77 /// new frames.Gets the next video frame from the MediaStream track. | |
78 /// | |
79 /// @param[in] frame A VideoFrame got from |GetFrame()|. | |
80 /// | |
81 /// @return An int32_t containing a result code from <code>pp_errors.h</code>. | |
82 /// Returns PP_ERROR_BADRESOURCE if resource isn't a valid video source. | |
83 /// Retruns PP_ERROR_BADARGUMENT if frame isn't a vaild video frame got from | |
84 /// |GetFrame()|. | |
85 /// Returns PP_ERROR_FAILED if the source is not open, or if some other | |
86 /// browser error occurs. | |
87 int32_t ReuseFrame(const VideoFrame& frame); | |
yzshen1
2013/12/20 23:37:43
Recycle?
Peng
2013/12/23 02:41:49
Done.
| |
88 }; | |
yzshen1
2013/12/20 23:37:43
Close()?
Peng
2013/12/23 02:41:49
Done.
| |
89 | |
90 } // namespace pp | |
91 | |
92 #endif // PPAPI_CPP_MEDIA_STREAM_VIDEO_TRACK_H_ | |
OLD | NEW |