GstOMXVideoDecClass *klass;
GstOMXBuffer *buf;
GstBuffer *codec_data = NULL;
- guint offset = 0;
+ guint offset = 0, size;
GstClockTime timestamp, duration, timestamp_offset = 0;
self = GST_OMX_VIDEO_DEC (decoder);
}
}
- while (offset < gst_buffer_get_size (frame->input_buffer)) {
+ size = gst_buffer_get_size (frame->input_buffer);
+ while (offset < size) {
/* Make sure to release the base class stream lock, otherwise
* _loop() can't call _finish_frame() and we might block forever
* because no input buffers are released */
/* Copy the buffer content in chunks of size as requested
* by the port */
+ buf->omx_buf->nFilledLen =
+ MIN (size - offset, buf->omx_buf->nAllocLen - buf->omx_buf->nOffset);
gst_buffer_extract (frame->input_buffer, offset,
buf->omx_buf->pBuffer + buf->omx_buf->nOffset,
buf->omx_buf->nFilledLen);
/* Interpolate timestamps if we're passing the buffer
* in multiple chunks */
if (offset != 0 && duration != GST_CLOCK_TIME_NONE) {
- timestamp_offset =
- gst_util_uint64_scale (offset, duration,
- gst_buffer_get_size (frame->input_buffer));
+ timestamp_offset = gst_util_uint64_scale (offset, duration, size);
}
if (timestamp != GST_CLOCK_TIME_NONE) {
}
if (duration != GST_CLOCK_TIME_NONE) {
buf->omx_buf->nTickCount =
- gst_util_uint64_scale (buf->omx_buf->nFilledLen, duration,
- gst_buffer_get_size (frame->input_buffer));
+ gst_util_uint64_scale (buf->omx_buf->nFilledLen, duration, size);
self->last_upstream_ts += duration;
}