[847/906] mixer: unmap the video frames we map

plugs a memory leak
This commit is contained in:
Matthew Waters 2013-11-13 15:57:07 +11:00 committed by Tim-Philipp Müller
parent 5ee09b36fa
commit ad315254e9

View file

@ -1433,6 +1433,7 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
guint out_tex; guint out_tex;
guint array_index = 0; guint array_index = 0;
guint i; guint i;
gboolean res;
GST_TRACE ("Processing buffers"); GST_TRACE ("Processing buffers");
@ -1457,7 +1458,8 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
GST_VIDEO_FRAME_HEIGHT (&out_frame))) { GST_VIDEO_FRAME_HEIGHT (&out_frame))) {
GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND,
("%s", "Failed to init upload format"), (NULL)); ("%s", "Failed to init upload format"), (NULL));
return FALSE; res = FALSE;
goto out;
} }
} }
@ -1498,8 +1500,10 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
if (!gst_video_frame_map (in_frame, &pad->in_info, mixcol->buffer, if (!gst_video_frame_map (in_frame, &pad->in_info, mixcol->buffer,
GST_MAP_READ | GST_MAP_GL)) { GST_MAP_READ | GST_MAP_GL)) {
++array_index; ++array_index;
pad->mapped = FALSE;
continue; continue;
} }
pad->mapped = TRUE;
if (gst_is_gl_memory (in_frame->map[0].memory)) { if (gst_is_gl_memory (in_frame->map[0].memory)) {
in_tex = *(guint *) in_frame->data[0]; in_tex = *(guint *) in_frame->data[0];
@ -1523,7 +1527,8 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
in_width, in_height, in_width, in_height)) { in_width, in_height, in_width, in_height)) {
GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND,
("%s", "Failed to init upload format"), (NULL)); ("%s", "Failed to init upload format"), (NULL));
return FALSE; res = FALSE;
goto out;
} }
if (!pad->in_tex_id) if (!pad->in_tex_id)
@ -1535,11 +1540,11 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
in_frame->data)) { in_frame->data)) {
GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND,
("%s", "Failed to upload video frame"), (NULL)); ("%s", "Failed to upload video frame"), (NULL));
return FALSE; res = FALSE;
goto out;
} }
in_tex = pad->in_tex_id; in_tex = pad->in_tex_id;
pad->mapped = TRUE;
} }
frame->texture = in_tex; frame->texture = in_tex;
@ -1554,10 +1559,12 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
out_frame.data)) { out_frame.data)) {
GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, ("%s", GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, ("%s",
"Failed to download video frame"), (NULL)); "Failed to download video frame"), (NULL));
return FALSE; res = FALSE;
goto out;
} }
} }
out:
i = 0; i = 0;
walk = mix->sinkpads; walk = mix->sinkpads;
while (walk) { while (walk) {
@ -1574,7 +1581,7 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
gst_video_frame_unmap (&out_frame); gst_video_frame_unmap (&out_frame);
return TRUE; return res;
} }
static void static void