{{+bindTo:partials.standard_nacl_article}}

PPB_MediaStreamAudioTrack Struct Reference

{{- dummy div to appease doxygen -}}

Data Fields

PP_Bool(* IsMediaStreamAudioTrack )(PP_Resource resource)
int32_t(* Configure )(PP_Resource audio_track, const int32_t attrib_list[], struct PP_CompletionCallback callback)
int32_t(* GetAttrib )(PP_Resource audio_track, PP_MediaStreamAudioTrack_Attrib attrib, int32_t *value)
struct PP_Var(* GetId )(PP_Resource audio_track)
PP_Bool(* HasEnded )(PP_Resource audio_track)
int32_t(* GetFrame )(PP_Resource audio_track, PP_Resource *frame, struct PP_CompletionCallback callback)
int32_t(* RecycleFrame )(PP_Resource audio_track, PP_Resource frame)
void(* Close )(PP_Resource audio_track)

Field Documentation

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

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

Parameters:
[in]audio_trackA PP_Resource corresponding to a MediaStream audio track resource.
int32_t(* PPB_MediaStreamAudioTrack::Configure)(PP_Resource audio_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_MEDIASTREAMAUDIOTRACK_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 Configure() is not called, default settings will be used. Example usage from plugin code:

 int32_t attribs[] = {
     PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERED_FRAMES, 4,
     PP_MEDIASTREAMAUDIOTRACK_ATTRIB_DURATION, 10,
     PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE};
 track_if->Configure(track, attribs, callback);
Parameters:
[in]audio_trackA PP_Resource corresponding to an audio 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_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE.
[in]callbackA PP_CompletionCallback to be called upon completion of Configure().
Returns:
An int32_t containing a result code from pp_errors.h.
int32_t(* PPB_MediaStreamAudioTrack::GetAttrib)(PP_Resource audio_track, PP_MediaStreamAudioTrack_Attrib attrib, int32_t *value)

Gets attribute value for a given attribute name.

Parameters:
[in]audio_trackA PP_Resource corresponding to an audio resource.
[in]attribA PP_MediaStreamAudioTrack_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.
int32_t(* PPB_MediaStreamAudioTrack::GetFrame)(PP_Resource audio_track, PP_Resource *frame, struct PP_CompletionCallback callback)

Gets the next audio 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]audio_trackA PP_Resource corresponding to an audio resource.
[out]frameA PP_Resource corresponding to an AudioFrame 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_MediaStreamAudioTrack::GetId)(PP_Resource audio_track) [read]

Returns the track ID of the underlying MediaStream audio track.

Parameters:
[in]audio_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]audio_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 audio track resource.

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

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]audio_trackA PP_Resource corresponding to an audio resource.
[in]frameA PP_Resource corresponding to an AudioFrame 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:
{{/partials.standard_nacl_article}}