d3d11h264dec: Cannot invoke CopySubresourceRegion...
Summary
In a pipeline which uses d3d11_
elements and includes a tee->x264enc->filesink branch, a copy error is thrown. The resultant mp4 file appears to be saved correctly, but is not playable. See below for example pipelines.
Exact error message:
0:07:52.986079200 16012 0000023D7A28AD40 ERROR d3d11debuglayer gstd3d11window_win32.cpp:1090:gst_d3d11_window_win32_present:<d3d11device12> D3D11InfoQueue: ID3D11DeviceContext::CopySubresourceRegion: Cannot invoke CopySubresourceRegion while a Subresource of the source is mapped.Source subresource (0) is mapped.
0:07:53.002466600 16012 0000023D7A28AD40 ERROR d3d11debuglayer gstd3d11window_win32.cpp:1090:gst_d3d11_window_win32_present:<d3d11device12> D3D11InfoQueue: ID3D11DeviceContext::CopySubresourceRegion: Cannot invoke CopySubresourceRegion while a Subresource of the source is mapped.Source subresource (0) is mapped.
Expected Behavior
No errors, files saved properly (when applicable).
Observed Behavior
Errors thrown every few seconds.
Setup
- Operating System: Windows 10
- Device: Computer
- GStreamer Version: v1.21.0 (latest-main)
rtspsrc location=rtsp://192.168.0.226:554/Videoinput/1/h264/1 latency=0 drop-on-latency=true ! decodebin ! textoverlay text=hello ! tee name=t \
t. ! queue ! videoconvert ! video/x-raw ! queue leaky=2 ! d3d11videosink name=prevSink sync=false \
t. ! queue leaky=2 ! x264enc bitrate=5000 tune=zerolatency speed-preset=ultrafast ! mp4mux ! fakesink
or, without an rtspsrc
,
videotestsrc ! video/x-raw,width=1280,height=720,format=I420 ! \
textoverlay text=hello valignment=top ! textoverlay text=goodbye valignment=bottom ! \
x264enc tune=zerolatency bitrate=2000 ! rtph264pay ! queue ! \
parsebin ! d3d11h264dec ! videoconvert ! video/x-raw ! tee name=t
t. ! queue ! d3d11videosink name=prevSink sync=false
t. ! queue ! x264enc bitrate=5000 tune=zerolatency speed-preset=ultrafast ! mp4mux ! fakesink
swapping out for avdec_h264 and d3dvideosink (no errors):
videotestsrc ! video/x-raw,width=1280,height=720,format=I420 ! \
textoverlay text=hello valignment=top ! textoverlay text=goodbye valignment=bottom ! \
x264enc tune=zerolatency bitrate=2000 ! rtph264pay ! queue ! \
parsebin ! avdec_h264 ! videoconvert ! video/x-raw ! tee name=t
t. ! queue ! d3dvideosink name=prevSink sync=true
t. ! queue ! x264enc bitrate=5000 tune=zerolatency speed-preset=ultrafast ! mp4mux ! fakesink
Steps to reproduce the bug
- Create an app using GstSharp and renders to a panel (example here: https://github.com/jakehedlund/GstLaunchPlayground)
- Run one of the above pipelines.
- Watch the console for errors.
How reproducible is the bug?
Always
Additional information
Setting sync=true
on the videosink seems to sometimes fix the problem or change how often the message is output.
In the case of the contrived videotestsrc
pipeline above, sync=false
changes how the errors are thrown, as does speed-preset=ultrafast
on x264enc
.