d3d11videosink: Ensure upload staging texture to fallback render texture

gst_video_frame_copy will copy input frame to stating texture
of fallback frame. Then, we need to map fallback texture with GST_MAP_D3D11
flag to upload the staging texture to render texture. Otherwise
the render texture wouldn't be updated.
This commit is contained in:
Seungha Yang 2020-02-16 17:11:29 +09:00
parent 9bf4746e2f
commit 36fb790243

View file

@ -735,6 +735,7 @@ gst_d3d11_video_sink_upload_frame (GstD3D11VideoSink * self, GstBuffer * inbuf,
{
GstVideoFrame in_frame, out_frame;
gboolean ret;
gint i;
if (!gst_video_frame_map (&in_frame, &self->info, inbuf,
GST_MAP_READ | GST_VIDEO_FRAME_MAP_FLAG_NO_REF))
@ -751,6 +752,22 @@ gst_d3d11_video_sink_upload_frame (GstD3D11VideoSink * self, GstBuffer * inbuf,
gst_video_frame_unmap (&in_frame);
gst_video_frame_unmap (&out_frame);
if (ret) {
/* map to upload staging texture to render texture */
for (i = 0; i < gst_buffer_n_memory (outbuf); i++) {
GstMemory *mem;
GstMapInfo map;
mem = gst_buffer_peek_memory (outbuf, i);
if (!gst_memory_map (mem, &map, (GST_MAP_READ | GST_MAP_D3D11))) {
GST_ERROR_OBJECT (self, "cannot upload staging texture");
ret = FALSE;
break;
}
gst_memory_unmap (mem, &map);
}
}
return ret;
/* ERRORS */