mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Merge pull request #10999 from thecodingwizard:nathan/ffmpeg-dec
PiperOrigin-RevId: 683280522
This commit is contained in:
+30
-2
@@ -21,8 +21,8 @@ import (
|
||||
"gvisor.dev/gvisor/pkg/test/dockerutil"
|
||||
)
|
||||
|
||||
// TestFffmpegGPU runs ffmpeg in a GPU container using NVENC.
|
||||
func TestFffmpegGPU(t *testing.T) {
|
||||
// TestFffmpegEncodeGPU runs ffmpeg in a GPU container using NVENC.
|
||||
func TestFffmpegEncodeGPU(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
isGVisor, err := dockerutil.IsGVisorRuntime(ctx, t)
|
||||
if err != nil {
|
||||
@@ -46,3 +46,31 @@ func TestFffmpegGPU(t *testing.T) {
|
||||
t.Errorf("failed to run container: %v; output:\n%s", err, output)
|
||||
}
|
||||
}
|
||||
|
||||
// TestFffmpegDecodeGPU runs ffmpeg in a GPU container using NVDEC.
|
||||
func TestFffmpegDecodeGPU(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
isGVisor, err := dockerutil.IsGVisorRuntime(ctx, t)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to determine if runtime is gVisor: %v", err)
|
||||
}
|
||||
if isGVisor {
|
||||
t.Skip("This test is currently broken in gVisor")
|
||||
}
|
||||
container := dockerutil.MakeContainer(ctx, t)
|
||||
defer container.CleanUp(ctx)
|
||||
opts, err := dockerutil.GPURunOpts(dockerutil.SniffGPUOpts{
|
||||
Capabilities: "NVIDIA_DRIVER_CAPABILITIES=video",
|
||||
AllowIncompatibleIoctl: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to get GPU run options: %v", err)
|
||||
}
|
||||
opts.Image = "benchmarks/ffmpeg"
|
||||
// h264_cuvid refers to NVDEC. See Section 4.2 in
|
||||
// https://docs.nvidia.com/video-technologies/video-codec-sdk/pdf/Using_FFmpeg_with_NVIDIA_GPU_Hardware_Acceleration.pdf
|
||||
cmd := strings.Split("ffmpeg -y -vsync 0 -c:v h264_cuvid -i video.mp4 output.yuv", " ")
|
||||
if output, err := container.Run(ctx, opts, cmd...); err != nil {
|
||||
t.Errorf("failed to run container: %v; output:\n%s", err, output)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user