PPB_MediaStreamVideoTrack Struct Reference

Data Fields

PP_Resource(* Create )(PP_Instance instance)
PP_Bool(* IsMediaStreamVideoTrack )(PP_Resource resource)
int32_t(* Configure )(PP_Resource video_track, const int32_t attrib_list[], struct PP_CompletionCallback callback)
int32_t(* GetAttrib )(PP_Resource video_track, PP_MediaStreamVideoTrack_Attrib attrib, int32_t *value)
struct PP_Var(* GetId )(PP_Resource video_track)
PP_Bool(* HasEnded )(PP_Resource video_track)
int32_t(* GetFrame )(PP_Resource video_track, PP_Resource *frame, struct PP_CompletionCallback callback)
int32_t(* RecycleFrame )(PP_Resource video_track, PP_Resource frame)
void(* Close )(PP_Resource video_track)
int32_t(* GetEmptyFrame )(PP_Resource video_track, PP_Resource *frame, struct PP_CompletionCallback callback)
int32_t(* PutFrame )(PP_Resource video_track, PP_Resource frame)

Field Documentation

Closes the MediaStream video track and disconnects it from video source.

After calling Close(), no new frames will be received.

Parameters:
[in]video_trackA PP_Resource corresponding to a MediaStream video track resource.
int32_t(* PPB_MediaStreamVideoTrack::Configure)(PP_Resource video_track, const int32_t attrib_list[], struct PP_CompletionCallback callback)

Configures underlying frame buffers for incoming frames.

If the application doesn't want to drop frames, then the PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES should be chosen such that inter-frame processing time variability won't overrun the input buffer. If the buffer is overfilled, then frames will be dropped. The application can detect this by examining the timestamp on returned frames. If some attributes are not specified, default values will be used for those unspecified attributes. If Configure() is not called, default settings will be used. Example usage from plugin code:

 int32_t attribs[] = {
     PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES, 4,
     PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE};
 track_if->Configure(track, attribs, callback);
Parameters:
[in]video_trackA PP_Resource corresponding to a video resource.
[in]attrib_listA list of attribute name-value pairs in which each attribute is immediately followed by the corresponding desired value. The list is terminated by PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE.
[in]callbackPP_CompletionCallback to be called upon completion of Configure().
Returns:
An int32_t containing a result code from pp_errors.h. Returns PP_ERROR_INPROGRESS if there is a pending call of Configure() or GetFrame(), or the plugin holds some frames which are not recycled with RecycleFrame(). If an error is returned, all attributes and the underlying buffer will not be changed.

Creates a PPB_MediaStreamVideoTrack resource for video output.

Call this when you will be creating frames and putting them to the track.

Parameters:
[in]instanceA PP_Instance identifying one instance of a module.
Returns:
A PP_Resource corresponding to a PPB_MediaStreamVideoTrack resource if successful, 0 if failed.
int32_t(* PPB_MediaStreamVideoTrack::GetAttrib)(PP_Resource video_track, PP_MediaStreamVideoTrack_Attrib attrib, int32_t *value)

Gets attribute value for a given attribute name.

Parameters:
[in]video_trackA PP_Resource corresponding to a video resource.
[in]attribA PP_MediaStreamVideoTrack_Attrib for querying.
[out]valueA int32_t for storing the attribute value on success. Otherwise, the value will not be changed.
Returns:
An int32_t containing a result code from pp_errors.h.

Gets a free frame for output.

The frame is allocated by Configure(). The caller should fill it with frame data, and then use |PutFrame()| to send the frame back.

int32_t(* PPB_MediaStreamVideoTrack::GetFrame)(PP_Resource video_track, PP_Resource *frame, struct PP_CompletionCallback callback)

Gets the next video frame from the MediaStream track.

If internal processing is slower than the incoming frame rate, new frames will be dropped from the incoming stream. Once the input buffer is full, frames will be dropped until RecycleFrame() is called to free a spot for another frame to be buffered. If there are no frames in the input buffer, PP_OK_COMPLETIONPENDING will be returned immediately and the callback will be called when a new frame is received or an error happens.

Parameters:
[in]video_trackA PP_Resource corresponding to a video resource.
[out]frameA PP_Resource corresponding to a VideoFrame resource.
[in]callbackA PP_CompletionCallback to be called upon completion of GetFrame().
Returns:
An int32_t containing a result code from pp_errors.h. Returns PP_ERROR_NOMEMORY if max_buffered_frames frames buffer was not allocated successfully.
struct PP_Var(* PPB_MediaStreamVideoTrack::GetId)(PP_Resource video_track) [read]

Returns the track ID of the underlying MediaStream video track.

Parameters:
[in]video_trackThe PP_Resource to check.
Returns:
A PP_Var containing the MediaStream track ID as a string.

Checks whether the underlying MediaStream track has ended.

Calls to GetFrame while the track has ended are safe to make and will complete, but will fail.

Parameters:
[in]video_trackThe PP_Resource to check.
Returns:
A PP_Bool with PP_TRUE if the given MediaStream track has ended or PP_FALSE otherwise.

Determines if a resource is a MediaStream video track resource.

Parameters:
[in]resourceThe PP_Resource to test.
Returns:
A PP_Bool with PP_TRUE if the given resource is a Mediastream video track resource or PP_FALSE otherwise.

Sends a frame returned by |GetEmptyFrame()| to the output track.

After this function, the |frame| should not be used anymore and the caller should release the reference that it holds.

Recycles a frame returned by GetFrame(), so the track can reuse the underlying buffer of this frame.

And the frame will become invalid. The caller should release all references it holds to frame and not use it anymore.

Parameters:
[in]video_trackA PP_Resource corresponding to a video resource.
[in]frameA PP_Resource corresponding to a VideoFrame resource returned by GetFrame().
Returns:
An int32_t containing a result code from pp_errors.h.

The documentation for this struct was generated from the following file: