public interface IVideoStreamListener
| Modifier and Type | Method and Description |
|---|---|
void |
sendFrame(byte[] data,
int offset,
int length,
long presentationTimeUs)
Sends a chunk of data which represents a frame to SDL Core.
|
void |
sendFrame(ByteBuffer data,
long presentationTimeUs)
Sends chunks of data which represent a frame to SDL Core.
|
void sendFrame(byte[] data,
int offset,
int length,
long presentationTimeUs)
throws ArrayIndexOutOfBoundsException
The format of the chunk should align with MediaCodec's "Compressed Buffer" format, i.e. it should contain a single video frame, and it should start and end on frame boundaries. Please refer to https://developer.android.com/reference/android/media/MediaCodec.html Also, for H.264 codec case the stream must be in byte-stream format (also known as Annex-B format). This isn't explained in the document above, but MediaCodec does output in this format.
In short, you can just provide MediaCodec's data outputs to this method without tweaking any data.
Note: this method must not be called after SdlProxyBase.endVideoStream() is called.
data - Byte array containing a video frameoffset - Starting offset in 'data'length - Length of the datapresentationTimeUs - Presentation timestamp (PTS) of this frame, in microseconds.
It must be greater than the previous timestamp.
Specify -1 if unknown.ArrayIndexOutOfBoundsException - When offset does not satisfy
0 <= offset && offset <= data.length
or length does not satisfy
0 < length && offset + length <= data.lengthvoid sendFrame(ByteBuffer data, long presentationTimeUs)
The format of the chunk should align with MediaCodec's "Compressed Buffer" format, i.e. it should contain a single video frame, and it should start and end on frame boundaries. Please refer to https://developer.android.com/reference/android/media/MediaCodec.html Also, for H.264 codec case the stream must be in byte-stream format (also known as Annex-B format). This isn't explained in the document above, but MediaCodec does output in this format.
In short, you can just provide MediaCodec's data outputs to this method without tweaking any data.
Note: this method must not be called after SdlProxyBase.endVideoStream() is called.
data - Data chunk to send. Its position will be updated upon return.presentationTimeUs - Presentation timestamp (PTS) of this frame, in microseconds.
It must be greater than the previous timestamp.
Specify -1 if unknown.