Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 5 |
| 6 /** | 6 /** |
| 7 * Defines the <code>PPB_MediaStreamVideoTrack</code> interface. Used for | 7 * Defines the <code>PPB_MediaStreamAudioTrack</code> interface. Used for |
| 8 * receiving video frames from a MediaStream video track in the browser. | 8 * receiving audio frames from a MediaStream audio track in the browser. |
| 9 * This interface is still in development (Dev API status) and may change. | 9 * This interface is still in development (Dev API status) and may change. |
| 10 */ | 10 */ |
| 11 label Chrome { | 11 label Chrome { |
| 12 [channel=dev] M34 = 0.1 | 12 [channel=dev] M34 = 0.1 |
| 13 }; | 13 }; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 */ | 16 */ |
| 17 interface PPB_MediaStreamVideoTrack { | 17 interface PPB_MediaStreamAudioTrack { |
|
dmichael (off chromium)
2014/01/07 22:00:59
We had a discussion about the names before holiday
Peng
2014/01/07 22:29:27
I asked yuzhu, the dev API can be changed. So I la
dmichael (off chromium)
2014/01/09 17:07:46
No, that's totally fine. We can come back around a
Peng
2014/01/09 20:59:58
Right now, I can not image how a plugin side track
| |
| 18 /** | 18 /** |
| 19 * Determines if a resource is a MediaStream video track resource. | 19 * Determines if a resource is a MediaStream audio track resource. |
| 20 * | 20 * |
| 21 * @param[in] resource The <code>PP_Resource</code> to test. | 21 * @param[in] resource The <code>PP_Resource</code> to test. |
| 22 * | 22 * |
| 23 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | 23 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
| 24 * resource is a Mediastream video track resource or <code>PP_FALSE</code> | 24 * resource is a Mediastream audio track resource or <code>PP_FALSE</code> |
| 25 * otherwise. | 25 * otherwise. |
| 26 */ | 26 */ |
| 27 PP_Bool IsMediaStreamVideoTrack([in] PP_Resource resource); | 27 PP_Bool IsMediaStreamAudioTrack([in] PP_Resource resource); |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * Configures underlying frame buffers for incoming frames. | 30 * Configures underlying frame buffers for incoming frames. |
| 31 * If the application doesn't want to drop frames, then the | 31 * If the application doesn't want to drop frames, then the |
| 32 * <code>max_buffered_frames</code> should be chosen such that inter-frame | 32 * <code>max_buffered_frames</code> should be chosen such that inter-frame |
| 33 * processing time variability won't overrun the input buffer. If the buffer | 33 * processing time variability won't overrun the input buffer. If the buffer |
| 34 * is overfilled, then frames will be dropped. The application can detect | 34 * is overfilled, then frames will be dropped. The application can detect |
| 35 * this by examining the timestamp on returned frames. | 35 * this by examining the timestamp on returned frames. |
| 36 * If <code>Configure()</code> is not used, default settings will be used. | 36 * If <code>Configure()</code> is not used, default settings will be used. |
| 37 * | 37 * |
| 38 * @param[in] video_track A <code>PP_Resource</code> corresponding to a video | 38 * @param[in] audio_track A <code>PP_Resource</code> corresponding to an audio |
| 39 * resource. | 39 * resource. |
| 40 * @param[in] max_buffered_frames The maximum number of video frames to | 40 * @param[in] samples_per_frame The number of audio samples in an audio frame. |
| 41 * @param[in] max_buffered_frames The maximum number of audio frames to | |
| 41 * hold in the input buffer. | 42 * hold in the input buffer. |
| 42 * | 43 * |
| 43 * @return An int32_t containing a result code from <code>pp_errors.h</code>. | 44 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
| 44 */ | 45 */ |
| 45 int32_t Configure([in] PP_Resource video_track, | 46 int32_t Configure([in] PP_Resource audio_track, |
| 47 [in] uint32_t samples_per_frame, | |
| 46 [in] uint32_t max_buffered_frames); | 48 [in] uint32_t max_buffered_frames); |
| 47 | 49 |
| 48 /** | 50 /** |
| 49 * Returns the track ID of the underlying MediaStream video track. | 51 * Returns the track ID of the underlying MediaStream audio track. |
| 50 * | 52 * |
| 51 * @param[in] video_track The <code>PP_Resource</code> to check. | 53 * @param[in] audio_track The <code>PP_Resource</code> to check. |
| 52 * | 54 * |
| 53 * @return A <code>PP_Var</code> containing the MediaStream track ID as | 55 * @return A <code>PP_Var</code> containing the MediaStream track ID as |
| 54 * a string. | 56 * a string. |
| 55 */ | 57 */ |
| 56 PP_Var GetId([in] PP_Resource video_track); | 58 PP_Var GetId([in] PP_Resource audio_track); |
| 57 | 59 |
| 58 /** | 60 /** |
| 59 * Checks whether the underlying MediaStream track has ended. | 61 * Checks whether the underlying MediaStream track has ended. |
| 60 * Calls to GetFrame while the track has ended are safe to make and will | 62 * Calls to GetFrame while the track has ended are safe to make and will |
| 61 * complete, but will fail. | 63 * complete, but will fail. |
| 62 * | 64 * |
| 63 * @param[in] video_track The <code>PP_Resource</code> to check. | 65 * @param[in] audio_track The <code>PP_Resource</code> to check. |
| 64 * | 66 * |
| 65 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | 67 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
| 66 * MediaStream track has ended or <code>PP_FALSE</code> otherwise. | 68 * MediaStream track has ended or <code>PP_FALSE</code> otherwise. |
| 67 */ | 69 */ |
| 68 PP_Bool HasEnded([in] PP_Resource video_track); | 70 PP_Bool HasEnded([in] PP_Resource audio_track); |
| 69 | 71 |
| 70 /** | 72 /** |
| 71 * Gets the next video frame from the MediaStream track. | 73 * Gets the next audio frame from the MediaStream track. |
| 72 * If internal processing is slower than the incoming frame rate, new frames | 74 * If internal processing is slower than the incoming frame rate, new frames |
| 73 * will be dropped from the incoming stream. Once the input buffer is full, | 75 * will be dropped from the incoming stream. Once the input buffer is full, |
| 74 * frames will be dropped until <code>RecycleFrame()</code> is called to free | 76 * frames will be dropped until <code>RecycleFrame()</code> is called to free |
| 75 * a spot for another frame to be buffered. | 77 * a spot for another frame to be buffered. |
| 76 * If there are no frames in the input buffer, | 78 * If there are no frames in the input buffer, |
| 77 * <code>PP_OK_COMPLETIONPENDING</code> will be returned immediately and the | 79 * <code>PP_OK_COMPLETIONPENDING</code> will be returned immediately and the |
| 78 * <code>callback</code> will be called, when a new frame is received or an | 80 * <code>callback</code> will be called, when a new frame is received or an |
| 79 * error happens. | 81 * error happens. |
| 80 * | 82 * |
| 81 * @param[in] video_track A <code>PP_Resource</code> corresponding to a video | 83 * @param[in] audio_track A <code>PP_Resource</code> corresponding to an audio |
| 82 * resource. | 84 * resource. |
| 83 * @param[out] frame A <code>PP_Resource</code> corresponding to a VideoFrame | 85 * @param[out] frame A <code>PP_Resource</code> corresponding to an AudioFrame |
| 84 * resource. | 86 * resource. |
| 85 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | 87 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 86 * completion of GetFrame(). | 88 * completion of GetFrame(). |
| 87 * | 89 * |
| 88 * @return An int32_t containing a result code from <code>pp_errors.h</code>. | 90 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
| 89 * Returns PP_ERROR_NOMEMORY if <code>max_buffered_frames</code> frames buffer | 91 * Returns PP_ERROR_NOMEMORY if <code>max_buffered_frames</code> frames buffer |
| 90 * was not allocated successfully. | 92 * was not allocated successfully. |
| 91 */ | 93 */ |
| 92 int32_t GetFrame([in] PP_Resource video_track, | 94 int32_t GetFrame([in] PP_Resource audio_track, |
| 93 [out] PP_Resource frame, | 95 [out] PP_Resource frame, |
| 94 [in] PP_CompletionCallback callback); | 96 [in] PP_CompletionCallback callback); |
| 95 | 97 |
| 96 /** | 98 /** |
| 97 * Recycles a frame returned by <code>GetFrame()</code>, so the track can | 99 * Recycles a frame returned by <code>GetFrame()</code>, so the track can |
| 98 * reuse the underlying buffer of this frame. And the frame will become | 100 * reuse the underlying buffer of this frame. And the frame will become |
| 99 * invalid. The caller should release all references it holds to | 101 * invalid. The caller should release all references it holds to |
| 100 * <code>frame</code> and not use it anymore. | 102 * <code>frame</code> and not use it anymore. |
| 101 * | 103 * |
| 102 * @param[in] video_track A <code>PP_Resource</code> corresponding to a video | 104 * @param[in] audio_track A <code>PP_Resource</code> corresponding to an audio |
| 103 * resource. | 105 * resource. |
| 104 * @param[in] frame A <code>PP_Resource</code> corresponding to a VideoFrame | 106 * @param[in] frame A <code>PP_Resource</code> corresponding to an AudioFrame |
| 105 * resource returned by <code>GetFrame()</code>. | 107 * resource returned by <code>GetFrame()</code>. |
| 106 * | 108 * |
| 107 * @return An int32_t containing a result code from <code>pp_errors.h</code>. | 109 * @return An int32_t containing a result code from <code>pp_errors.h</code>. |
| 108 */ | 110 */ |
| 109 int32_t RecycleFrame([in] PP_Resource video_track, | 111 int32_t RecycleFrame([in] PP_Resource audio_track, |
| 110 [in] PP_Resource frame); | 112 [in] PP_Resource frame); |
| 111 | 113 |
| 112 /** | 114 /** |
| 113 * Closes the MediaStream video track and disconnects it from video source. | 115 * Closes the MediaStream audio track and disconnects it from audio source. |
|
dmichael (off chromium)
2014/01/07 22:00:59
from +the+ audio
Peng
2014/01/07 22:29:27
Done.
| |
| 114 * After calling <code>Close()</code>, no new frames will be received. | 116 * After calling <code>Close()</code>, no new frames will be received. |
| 115 * | 117 * |
| 116 * @param[in] video_track A <code>PP_Resource</code> corresponding to a | 118 * @param[in] audio_track A <code>PP_Resource</code> corresponding to a |
| 117 * MediaStream video track resource. | 119 * MediaStream audio track resource. |
| 118 */ | 120 */ |
| 119 void Close([in] PP_Resource video_track); | 121 void Close([in] PP_Resource audio_track); |
| 120 }; | 122 }; |
| 121 | 123 |
| OLD | NEW |