Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
d81c3e3
Add test wheel job
NicolasHug Aug 5, 2025
78ea520
Make pybind extension a pyd instead of dll
NicolasHug Aug 5, 2025
a0dd832
empty
NicolasHug Aug 5, 2025
1b5f926
libtorchcodec_custom_ops may not be able to find libtorchcodec_core. …
NicolasHug Aug 5, 2025
218ca2d
Try to add more debugging output on Windows
NicolasHug Aug 5, 2025
4cce232
Print more debug
NicolasHug Aug 5, 2025
ab53ca9
More debug stuff
NicolasHug Aug 5, 2025
8450297
Use MSVC toolchain when building FFmpeg on Windows
NicolasHug Aug 5, 2025
3b79ff5
Use msvc-built FFmpeg binaries when building the wheel
NicolasHug Aug 5, 2025
e4f00a4
Merge branch 'buildffmpegwindowsmsvc' into windows-tests
NicolasHug Aug 5, 2025
ac8116d
Try init_dll_path like in audio. But they only do it on 3.8
NicolasHug Aug 5, 2025
9573fc2
revert previous. Now add Python3_FIND_ABI and explicitly set Python3 …
NicolasHug Aug 5, 2025
963590e
Set core lib dependencies as PRIVATE???
NicolasHug Aug 5, 2025
2f2c91d
Same logic but try exposing the include directories as public
NicolasHug Aug 5, 2025
d896211
OK at this point I have no idea
NicolasHug Aug 5, 2025
01f9dc0
Add test job on Windows.
NicolasHug Aug 6, 2025
60df908
Revert "OK at this point I have no idea"
NicolasHug Aug 6, 2025
09d077e
Revert "Same logic but try exposing the include directories as public"
NicolasHug Aug 6, 2025
61ef07b
Revert "Set core lib dependencies as PRIVATE???"
NicolasHug Aug 6, 2025
1ae09aa
debug
NicolasHug Aug 6, 2025
6921d4c
oops
NicolasHug Aug 6, 2025
dab2d8e
Continuing
NicolasHug Aug 6, 2025
ff91aca
oops
NicolasHug Aug 6, 2025
bc919cc
Try to build from source
NicolasHug Aug 6, 2025
d988393
DEBUG stuff
NicolasHug Aug 6, 2025
9da6539
fix
NicolasHug Aug 6, 2025
99d0308
empty
NicolasHug Aug 7, 2025
7247adc
Make it a MODULE?????
NicolasHug Aug 7, 2025
11a7c55
Put back wheel build and wheel test
NicolasHug Aug 9, 2025
2bdb643
add more python versions
NicolasHug Aug 9, 2025
7b12d7d
Ensure that the CMake build type is respected alsof for multi-config …
traversaro Aug 19, 2025
e7969d3
Merge pull request #1 from traversaro/patch-13
NicolasHug Aug 19, 2025
cbff515
try not using MSVC ffmpeg
NicolasHug Aug 19, 2025
f7c8bd5
Remove windows-specific debug in ops
NicolasHug Aug 19, 2025
02ad2d7
Merge commit 'f7c8bd5bb78dd57c3f47c005046d1ecca3662146' into windows-…
NicolasHug Aug 19, 2025
8764c60
Merge branch 'main' of github.com:pytorch/torchcodec into windows-tests
NicolasHug Aug 19, 2025
110f5b0
remove USE_MSVC_FFMPEG
NicolasHug Aug 19, 2025
f0edf32
remove changes to packaging/build_ffmpeg.sh
NicolasHug Aug 19, 2025
aacbfc6
remove TORCH_LIBRARY from custom_ops_dependencies, should be transitive
NicolasHug Aug 19, 2025
fc17647
Keep custom_ops SHARED instead of MODULE
NicolasHug Aug 19, 2025
5da6109
Merge branch 'main' of github.com:pytorch/torchcodec into windows-tests
NicolasHug Aug 19, 2025
99cedf1
Merge commit 'fc17647' into windows-tests
NicolasHug Aug 19, 2025
fd0b7d5
Merge commit 'aacbfc6' into windows-tests
NicolasHug Aug 19, 2025
e08b5e7
Remove Python3::Python dep for custom_ops
NicolasHug Aug 19, 2025
f073d1f
let custom_ops be a dll instead of pyd
NicolasHug Aug 19, 2025
2f51f25
Merge commit 'f073d1f' into windows-tests
NicolasHug Aug 19, 2025
ae8a2c6
Put comment back
NicolasHug Aug 19, 2025
3b06000
comment
NicolasHug Aug 19, 2025
06d0627
remove Python3_FIND_ABI
NicolasHug Aug 19, 2025
5903c07
Comments
NicolasHug Aug 20, 2025
c7c6077
lint
NicolasHug Aug 20, 2025
7822d73
try to fix encoder tests
NicolasHug Aug 20, 2025
8a30f92
remove windows-specific output dir
NicolasHug Aug 21, 2025
b7b0ea9
Avoid 3.13 builds
NicolasHug Aug 21, 2025
f25a0a7
Use flac in test_num_channels
NicolasHug Aug 21, 2025
89e213d
Merge commit '8a30f92' into windows-tests
NicolasHug Aug 21, 2025
281cc38
Fix json list?
NicolasHug Aug 21, 2025
f2c3414
Test on more ffmpeg versions
NicolasHug Aug 21, 2025
12df6c7
skip mp3 tests on windows when ffmpeg <= 5
NicolasHug Aug 21, 2025
9048f6c
better close??
NicolasHug Aug 21, 2025
c02ffc5
use 5.0.1 instead of 5.1.2
NicolasHug Aug 22, 2025
4e4f739
Use 5.1.1
NicolasHug Aug 22, 2025
e40dfc2
cleanup
NicolasHug Aug 22, 2025
ff6d5d1
Rely on defaults for python versions
NicolasHug Aug 26, 2025
f83e9da
Set 3.10 as minimum supported version
NicolasHug Aug 26, 2025
23c20de
Merge branch 'main' of github.com:pytorch/torchcodec into windows-tests
NicolasHug Aug 26, 2025
7657857
Merge branch 'threeten' into windows-tests
NicolasHug Aug 26, 2025
b531d4b
Set 3.10 for windows as well
NicolasHug Aug 26, 2025
d89f81a
Shorter test name
NicolasHug Aug 26, 2025
5171e8c
Merge branch 'alefjnlajenfaef' into windows-tests
NicolasHug Aug 26, 2025
3892751
Merge branch 'main' into windows-tests
NicolasHug Aug 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/windows_wheel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,74 @@ jobs:
# The BUILD_AGAINST_ALL_FFMPEG_FROM_S3 var, needed to build the wheel, is
# set in vc_env_helper.bat Couldn't find a way to set it from here.
build-command: "python -m build --wheel -vvv --no-isolation"

install-and-test:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
# TODO: FFmpeg 5 on Windows segfaults in avcodec_open2() when passing
# bad parameters.
# See https://github.com/pytorch/torchcodec/pull/806
ffmpeg-version-for-tests: ['4.4.2', '6.1.1', '7.0.1']
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: pytorch_torchcodec__${{ matrix.python-version }}_cpu_x64
path: pytorch/torchcodec/dist/
- name: Setup conda env
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniconda-version: "latest"
activate-environment: test
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install PyTorch
run: |
python -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
- name: Install torchcodec from the wheel
run: |
wheel_path=`find pytorch/torchcodec/dist -type f -name "*.whl"`
echo Installing $wheel_path
python -m pip install $wheel_path -vvv
- name: Check out repo
uses: actions/checkout@v3
- name: Install ffmpeg, post build
run: |
# Ideally we would have checked for that before installing the wheel,
# but we need to checkout the repo to access this file, and we don't
# want to checkout the repo before installing the wheel to avoid any
# side-effect. It's OK.
source packaging/helpers.sh
assert_ffmpeg_not_installed
conda install "ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" -c conda-forge
ffmpeg -version
- name: Test torchcodec import after FFmpeg installation
run: |
echo "Testing torchcodec import after FFmpeg is installed and PATH is updated..."
python -c "import torchcodec; print('TorchCodec import successful!')"
- name: Install test dependencies
run: |
# Ideally we would find a way to get those dependencies from pyproject.toml
python -m pip install numpy pytest pillow
- name: Delete the src/ folder just for fun
run: |
# The only reason we checked-out the repo is to get access to the
# tests. We don't care about the rest. Out of precaution, we delete
# the src/ folder to be extra sure that we're running the code from
# the installed wheel rather than from the source.
# This is just to be extra cautious and very overkill because a)
# there's no way the `torchcodec` package from src/ can be found from
# the PythonPath: the main point of `src/` is precisely to protect
# against that and b) if we ever were to execute code from
# `src/torchcodec`, it would fail loudly because the built .so files
# aren't present there.
rm -r src/
ls
- name: Run Python tests
run: |
pytest test -vvv
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,14 @@ def _build_all_extensions_with_cmake(self):
["cmake", str(_ROOT_DIR)] + cmake_args, cwd=self.build_temp
)
print("Calling cmake --build", flush=True)
subprocess.check_call(["cmake", "--build", "."], cwd=self.build_temp)
subprocess.check_call(
["cmake", "--build", ".", "--config", cmake_build_type], cwd=self.build_temp
)
print("Calling cmake --install", flush=True)
subprocess.check_call(["cmake", "--install", "."], cwd=self.build_temp)
subprocess.check_call(
["cmake", "--install", ".", "--config", cmake_build_type],
cwd=self.build_temp,
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above is the main fix that was needed for the extensions to load properly, something I had been blocked on for a few weeks. The fix is from @traversaro :

NicolasHug#1

IIUC, on windows and with our current setup, cmake is generating multiple build files. And without this fix, the different build files would be inheriting different build configuration. Typically we'd be building some parts with the Release build type, while other would be inheriting a different build type, causing problems at runtime when loading the libraries.

@traversaro thank you so much again for unblocking us!


def copy_extensions_to_source(self):
"""Copy built extensions from temporary folder back into source tree.
Expand All @@ -156,7 +161,7 @@ def copy_extensions_to_source(self):
# https://stackoverflow.com/a/2339910
extensions = ["dylib", "so"]
elif sys.platform in ("win32", "cygwin"):
extensions = ["dll"]
extensions = ["dll", "pyd"]
else:
raise NotImplementedError(f"Platform {sys.platform} is not supported")

Expand Down
31 changes: 13 additions & 18 deletions src/torchcodec/_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,6 @@ function(make_torchcodec_sublibrary
# Avoid adding the "lib" prefix which we already add explicitly.
set_target_properties(${library_name} PROPERTIES PREFIX "")

if(WIN32)
# On Windows, the built artifacts are put in Release/Debug
# subdirectories by default. We want to avoid that, otherwise our
# install() step would not know where to find those.
set_target_properties(${library_name} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}
ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}
)
endif()

Copy link
Contributor Author

@NicolasHug NicolasHug Aug 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@traversaro correctly pointed out that this can now be removed, as a consequence of the other cmake_build_type fix below #806 (comment)

target_link_libraries(
${library_name}
PUBLIC
Expand All @@ -84,16 +70,17 @@ function(make_torchcodec_libraries
#
# 1. libtorchcodec_coreN.{ext}: Base library which contains the
# implementation of VideoDecoder and everything VideoDecoder needs. On
# Linux, {ext} is so. On Mac, it is dylib.
# Linux, {ext} is so. On Mac, it is dylib. On Windows it's dll.
#
# 2. libtorchcodec_custom_opsN.{ext}: Implementation of the PyTorch custom
# ops. Depends on libtorchcodec_coreN.{ext}. On Linux, {ext} is so.
# On Mac, it is dylib.
# On Mac, it is dylib. On Windows it's dll.
#
# 3. libtorchcodec_pybind_opsN.{ext}: Implementation of the pybind11 ops. We
# keep these separate from the PyTorch custom ops because we have to
# load these libraries separately on the Python side. Depends on
# libtorchcodec_coreN.{ext}. On BOTH Linux and Mac {ext} is so.
# libtorchcodec_coreN.{ext}. On BOTH Linux and Mac {ext} is so. On
# Windows, it's pyd.

# 1. Create libtorchcodec_coreN.{ext}.
set(core_library_name "libtorchcodec_core${ffmpeg_major_version}")
Expand Down Expand Up @@ -174,6 +161,14 @@ function(make_torchcodec_libraries
"${pybind_ops_sources}"
"${pybind_ops_dependencies}"
)

if(WIN32)
# On Windows, we need to set the suffix to .pyd so that Python can
# import the shared library as a module. Just setting the MODULE type
# isn't enough.
set_target_properties(${pybind_ops_library_name} PROPERTIES SUFFIX ".pyd")
endif()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is actually important, tried removing it in #826 and loading fails.

# pybind11 limits the visibility of symbols in the shared library to prevent
# stray initialization of py::objects. The rest of the object code must
# match. See:
Expand Down Expand Up @@ -223,7 +218,7 @@ function(make_torchcodec_libraries
install(
TARGETS ${all_libraries}
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} # For Windows DLLs
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} # For Windows
)

endfunction()
Expand Down
8 changes: 6 additions & 2 deletions src/torchcodec/_core/Encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,14 @@ AudioEncoder::~AudioEncoder() {

void AudioEncoder::close_avio() {
if (avFormatContext_ && avFormatContext_->pb) {
avio_flush(avFormatContext_->pb);
if (avFormatContext_->pb->error == 0) {
avio_flush(avFormatContext_->pb);
}

if (!avioContextHolder_) {
avio_close(avFormatContext_->pb);
if (avFormatContext_->pb->error == 0) {
avio_close(avFormatContext_->pb);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above is a drive-by as I was trying to fix the problem with FFmpeg 5. I'm not sure it fixed anything, but it is probably still a good change to have? I can extract it out in another PR if it's preferred.

Copy link
Contributor

@Dan-Flores Dan-Flores Aug 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this code imply that if the AVIOContext stored in avFormatContext_ has an error, we do not need to flush / close it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my digging, it's also that it's risky to call flush when there's an error state. Seems reasonable to keep it in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it because when error isn't 0 then flushing or calling avio_close() are potentially accessing invalid data.

// avoids closing again in destructor, which would segfault.
avFormatContext_->pb = nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/torchcodec/_internally_replaced_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _get_extension_path(lib_name: str) -> str:
elif sys.platform == "darwin":
extension_suffixes = importlib.machinery.EXTENSION_SUFFIXES + [".dylib"]
elif sys.platform in ("win32", "cygwin"):
extension_suffixes = importlib.machinery.EXTENSION_SUFFIXES + [".dll"]
extension_suffixes = importlib.machinery.EXTENSION_SUFFIXES + [".dll", ".pyd"]
else:
raise NotImplementedError(f"{sys.platform = } is not not supported")
loader_details = (
Expand Down
57 changes: 45 additions & 12 deletions test/test_encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
assert_tensor_close_on_at_least,
get_ffmpeg_major_version,
in_fbcode,
IS_WINDOWS,
NASA_AUDIO_MP3,
SINE_MONO_S32,
TestContainerFile,
Expand Down Expand Up @@ -151,15 +152,29 @@ def test_bad_input_parametrized(self, method, tmp_path):
raise ValueError(f"Unknown method: {method}")

decoder = AudioEncoder(self.decode(NASA_AUDIO_MP3).data, sample_rate=10)
with pytest.raises(RuntimeError, match="invalid sample rate=10"):
avcodec_open2_failed_msg = "avcodec_open2 failed: Invalid argument"
with pytest.raises(
RuntimeError,
match=avcodec_open2_failed_msg if IS_WINDOWS else "invalid sample rate=10",
):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above and in other tests below: on Windows, we're hitting this early return:

https://github.com/pytorch/torchcodec/blob/05a6ff59baf7bf1ab7e44ca79b923c2a4474ca96/src/torchcodec/_core/Encoder.cpp#L35-L38

So we're unable to validate some parameters early, and we just fail in the call to avcodec_open2() later:

https://github.com/pytorch/torchcodec/blob/05a6ff59baf7bf1ab7e44ca79b923c2a4474ca96/src/torchcodec/_core/Encoder.cpp#L213-L217

getattr(decoder, method)(**valid_params)

decoder = AudioEncoder(
self.decode(NASA_AUDIO_MP3).data, sample_rate=NASA_AUDIO_MP3.sample_rate
)
with pytest.raises(RuntimeError, match="invalid sample rate=10"):
with pytest.raises(
RuntimeError,
match=avcodec_open2_failed_msg if IS_WINDOWS else "invalid sample rate=10",
):
getattr(decoder, method)(sample_rate=10, **valid_params)
with pytest.raises(RuntimeError, match="invalid sample rate=99999999"):
with pytest.raises(
RuntimeError,
match=(
avcodec_open2_failed_msg
if IS_WINDOWS
else "invalid sample rate=99999999"
),
):
getattr(decoder, method)(sample_rate=99999999, **valid_params)
with pytest.raises(RuntimeError, match="bit_rate=-1 must be >= 0"):
getattr(decoder, method)(**valid_params, bit_rate=-1)
Expand All @@ -175,12 +190,14 @@ def test_bad_input_parametrized(self, method, tmp_path):
self.decode(NASA_AUDIO_MP3).data, sample_rate=NASA_AUDIO_MP3.sample_rate
)
for num_channels in (0, 3):
with pytest.raises(
RuntimeError,
match=re.escape(
match = (
avcodec_open2_failed_msg
if IS_WINDOWS
else re.escape(
f"Desired number of channels ({num_channels}) is not supported"
),
):
)
)
with pytest.raises(RuntimeError, match=match):
getattr(decoder, method)(**valid_params, num_channels=num_channels)

@pytest.mark.parametrize("method", ("to_file", "to_tensor", "to_file_like"))
Expand Down Expand Up @@ -240,6 +257,9 @@ def test_against_cli(

if get_ffmpeg_major_version() == 4 and format == "wav":
pytest.skip("Swresample with FFmpeg 4 doesn't work on wav files")
if IS_WINDOWS and get_ffmpeg_major_version() <= 5 and format == "mp3":
# TODO: https://github.com/pytorch/torchcodec/issues/837
pytest.skip("Encoding mp3 on Windows is weirdly buggy")

encoded_by_ffmpeg = tmp_path / f"ffmpeg_output.{format}"
subprocess.run(
Expand Down Expand Up @@ -295,8 +315,15 @@ def test_against_cli(
rtol, atol = 0, 1e-3
else:
rtol, atol = None, None

if IS_WINDOWS and format == "mp3":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this condition be hit? It might be duplicate with the check and pytest.skip on line 260

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check above only skips on FFmpeg <= 5, but FFmpeg 6 and 7 will still reach this line :)

# We're getting a "Could not open input file" on Windows mp3 files when decoding.
# TODO: https://github.com/pytorch/torchcodec/issues/837
return

samples_by_us = self.decode(encoded_by_us)
samples_by_ffmpeg = self.decode(encoded_by_ffmpeg)

assert_close(
samples_by_us.data,
samples_by_ffmpeg.data,
Expand All @@ -320,6 +347,9 @@ def test_against_to_file(
):
if get_ffmpeg_major_version() == 4 and format == "wav":
pytest.skip("Swresample with FFmpeg 4 doesn't work on wav files")
if IS_WINDOWS and get_ffmpeg_major_version() <= 5 and format == "mp3":
# TODO: https://github.com/pytorch/torchcodec/issues/837
pytest.skip("Encoding mp3 on Windows is weirdly buggy")

encoder = AudioEncoder(self.decode(asset).data, sample_rate=asset.sample_rate)

Expand All @@ -340,9 +370,12 @@ def test_against_to_file(
else:
raise ValueError(f"Unknown method: {method}")

torch.testing.assert_close(
self.decode(encoded_file).data, self.decode(encoded_output).data
)
if not (IS_WINDOWS and format == "mp3"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here, is this a duplicate check with line 319? On a similar note, it might be better to explicitly call pytest.skip whenever we are not running a test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a duplicate because this will be reached by FFmpeg 6 and 7. You're right that we should generally prefer using pytest.skip to just return, or to doing what we're doing here: it's better to know that a test was skipped, rather than seeing it be green when in fact it never ran.

In this specific case I think it's best not to call pytest.skip, because the test is still doing something meaningful just above. Specifically it calls the encoding methods, without error. We are only skipping the assert_close() check.

# We're getting a "Could not open input file" on Windows mp3 files when decoding.
# TODO: https://github.com/pytorch/torchcodec/issues/837
torch.testing.assert_close(
self.decode(encoded_file).data, self.decode(encoded_output).data
)

def test_encode_to_tensor_long_output(self):
# Check that we support re-allocating the output tensor when the encoded
Expand Down Expand Up @@ -417,7 +450,7 @@ def test_num_channels(

sample_rate = 16_000
source_samples = torch.rand(num_channels_input, 1_000)
format = "mp3"
format = "flac"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this change enable the test to pass on Windows? If so, we could parameterize the format and add an IS_WINDOWS check to skip if IS_WINDOWS and format == "mp3", as in tests above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, I changed from mp3 to flac due to the issues we had on Windows.

I agree that we could parameterize, but I'm not sure it's necessary for the purpose of this test, as it wouldn't make it more robust. Mostly this test is just about checking the number of output channels is respected, which is agnostic to the format.


encoder = AudioEncoder(source_samples, sample_rate=sample_rate)
params = dict(num_channels=num_channels_output)
Expand Down
2 changes: 2 additions & 0 deletions test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from torchcodec._core import get_ffmpeg_library_versions
from torchcodec.decoders._video_decoder import _read_custom_frame_mappings

IS_WINDOWS = sys.platform in ("win32", "cygwin")


# Decorator for skipping CUDA tests when CUDA isn't available. The tests are
# effectively marked to be skipped in pytest_collection_modifyitems() of
Expand Down
Loading