mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
v4l2codecs: Fix bytesused value
Pass the actual amount of bytes we have copied into the bitstream buffer. Also unmap the memory before queuing.
This commit is contained in:
parent
0d740a184e
commit
b107c20198
3 changed files with 13 additions and 5 deletions
|
@ -559,7 +559,8 @@ static void
|
|||
gst_v4l2_codec_h264_dec_reset_picture (GstV4l2CodecH264Dec * self)
|
||||
{
|
||||
if (self->bitstream) {
|
||||
gst_memory_unmap (self->bitstream, &self->bitstream_map);
|
||||
if (self->bitstream_map.memory)
|
||||
gst_memory_unmap (self->bitstream, &self->bitstream_map);
|
||||
g_clear_pointer (&self->bitstream, gst_memory_unref);
|
||||
self->bitstream_map = (GstMapInfo) GST_MAP_INFO_INIT;
|
||||
}
|
||||
|
@ -576,6 +577,7 @@ gst_v4l2_codec_h264_dec_end_picture (GstH264Decoder * decoder,
|
|||
GstV4l2Request *request;
|
||||
GstBuffer *buffer;
|
||||
GstFlowReturn flow_ret;
|
||||
gsize bytesused;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
struct v4l2_ext_control control[] = {
|
||||
|
@ -625,8 +627,12 @@ gst_v4l2_codec_h264_dec_end_picture (GstH264Decoder * decoder,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bytesused = self->bitstream_map.size;
|
||||
gst_memory_unmap (self->bitstream, &self->bitstream_map);
|
||||
self->bitstream_map = (GstMapInfo) GST_MAP_INFO_INIT;
|
||||
|
||||
if (!gst_v4l2_decoder_queue_sink_mem (self->decoder, request, self->bitstream,
|
||||
picture->system_frame_number)) {
|
||||
picture->system_frame_number, bytesused)) {
|
||||
GST_ELEMENT_ERROR (decoder, RESOURCE, WRITE,
|
||||
("Driver did not accept the bitstream data."), (NULL));
|
||||
return FALSE;
|
||||
|
|
|
@ -354,11 +354,12 @@ gst_v4l2_decoder_export_buffer (GstV4l2Decoder * self,
|
|||
|
||||
gboolean
|
||||
gst_v4l2_decoder_queue_sink_mem (GstV4l2Decoder * self,
|
||||
GstV4l2Request * request, GstMemory * mem, guint32 frame_num)
|
||||
GstV4l2Request * request, GstMemory * mem, guint32 frame_num,
|
||||
gsize bytesused)
|
||||
{
|
||||
gint ret;
|
||||
struct v4l2_plane plane = {
|
||||
.bytesused = gst_memory_get_sizes (mem, NULL, NULL),
|
||||
.bytesused = bytesused,
|
||||
};
|
||||
struct v4l2_buffer buf = {
|
||||
.type = direction_to_buffer_type (GST_PAD_SINK),
|
||||
|
|
|
@ -69,7 +69,8 @@ gboolean gst_v4l2_decoder_export_buffer (GstV4l2Decoder * self,
|
|||
gboolean gst_v4l2_decoder_queue_sink_mem (GstV4l2Decoder * self,
|
||||
GstV4l2Request * request,
|
||||
GstMemory * mem,
|
||||
guint32 frame_num);
|
||||
guint32 frame_num,
|
||||
gsize bytesused);
|
||||
|
||||
gboolean gst_v4l2_decoder_dequeue_sink (GstV4l2Decoder * self);
|
||||
|
||||
|
|
Loading…
Reference in a new issue