fix nvidia pipeline that only requires setparams (#1074)

This commit is contained in:
Jason Dove
2022-12-24 13:19:27 -06:00
committed by GitHub
parent 0f817308a8
commit 731072425b
2 changed files with 8 additions and 4 deletions
@@ -130,6 +130,9 @@ public class TranscodingTests
// example format that requires colorspace filter // example format that requires colorspace filter
new("libx264", "yuv420p", "tv", "smpte170m", "bt709", "smpte170m"), new("libx264", "yuv420p", "tv", "smpte170m", "bt709", "smpte170m"),
// example format that requires setparams filter
new("libx264", "yuv420p", string.Empty, string.Empty, string.Empty, string.Empty),
// new("libx264", "yuvj420p"), // new("libx264", "yuvj420p"),
new("libx264", "yuv420p10le"), new("libx264", "yuv420p10le"),
// new("libx264", "yuv444p10le"), // new("libx264", "yuv444p10le"),
@@ -300,13 +300,14 @@ public class NvidiaPipelineBuilder : SoftwarePipelineBuilder
if (currentState.FrameDataLocation == FrameDataLocation.Hardware) if (currentState.FrameDataLocation == FrameDataLocation.Hardware)
{ {
bool noPipelineFilters = !pipelineSteps.OfType<IPipelineFilterStep>().Any(); bool noPipelineFilters = !pipelineSteps
bool softwareColorspace = result is [ColorspaceFilter colorspace] && .Filter(ps => ps is not IEncoder)
!colorspace.Filter.StartsWith("setparams="); .OfType<IPipelineFilterStep>().Any();
bool hasColorspace = result is [ColorspaceFilter];
bool softwareDecoder = ffmpegState.DecoderHardwareAccelerationMode == HardwareAccelerationMode.None; bool softwareDecoder = ffmpegState.DecoderHardwareAccelerationMode == HardwareAccelerationMode.None;
if (softwareDecoder || (noPipelineFilters && softwareColorspace)) if (softwareDecoder || (noPipelineFilters && hasColorspace))
{ {
result.Add(new CudaFormatFilter(format)); result.Add(new CudaFormatFilter(format));
} }