[Bugfix][Multimodal] Recover PyNvVideoCodec decoder slots after failures (#59597)
Signed-off-by: Daniel Afrimi <dafrimi@nvidia.com> Signed-off-by: danielafrimi <45691845+danielafrimi@users.noreply.github.com> Signed-off-by: Daniel Afrimi <dafrimi@oci-hsg-cs-001-login-02.cm.cluster> Co-authored-by: OpenAI Codex <noreply@openai.com> Co-authored-by: Daniel Afrimi <dafrimi@oci-hsg-cs-001-login-02.cm.cluster> Co-authored-by: tomeras91 <57313761+tomeras91@users.noreply.github.com>
This commit is contained in:
co-authored by
OpenAI Codex
Daniel Afrimi
tomeras91
parent
c5f8adc0b1
commit
a9fe30e9f6
@@ -387,9 +387,14 @@ def test_pynvvideocodec_unrelated_error_propagates(
|
||||
monkeypatch.setitem(sys.modules, "PyNvVideoCodec", fake_nvc)
|
||||
original_error = RuntimeError("GPU decoder unavailable")
|
||||
|
||||
def raise_unrelated_error(cls, file_path, nvc):
|
||||
def raise_unrelated_error(cls, file_path, nvc, max_width, max_height):
|
||||
raise original_error
|
||||
|
||||
monkeypatch.setattr(
|
||||
PyNvVideoCodecVideoBackendMixin,
|
||||
"_validate_decoder_caps",
|
||||
classmethod(lambda cls, file_path, nvc, **kwargs: (4096, 4096)),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
PyNvVideoCodecVideoBackendMixin,
|
||||
"_read_source_metadata",
|
||||
@@ -464,6 +469,18 @@ class TestMergeKwargsGpuBackendPolicy:
|
||||
)
|
||||
assert result["hw_decoders"] == 2
|
||||
|
||||
def test_prevents_request_level_pynv_dimension_override(self):
|
||||
result = VideoMediaIO.merge_kwargs(
|
||||
default_kwargs={
|
||||
"backend": "pynvvideocodec",
|
||||
"max_width": 3840,
|
||||
"max_height": 2160,
|
||||
},
|
||||
runtime_kwargs={"max_width": 1920, "max_height": 1080},
|
||||
)
|
||||
assert result["max_width"] == 3840
|
||||
assert result["max_height"] == 2160
|
||||
|
||||
@pytest.mark.parametrize("backend", ["opencv", "torchcodec"])
|
||||
def test_software_video_backend_passes_through(self, backend: str):
|
||||
result = VideoMediaIO.merge_kwargs(
|
||||
|
||||
Reference in New Issue
Block a user