Commit 9f14fa63 authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

Build ffmpeg-features in Linux/macOS unittests (#2114)

Summary:
Preparation to land Python front-end of ffmpeg-related features.

- Set BUILD_FFMPEG=1 in Linux/macOS unit test jobs
- Install ffmpeg and pkg-config from conda-forge
- Add note about Windows build process
- Temporarily avoid `av_err2str`

Pull Request resolved: https://github.com/pytorch/audio/pull/2114

Reviewed By: hwangjeff

Differential Revision: D33371346

Pulled By: mthrok

fbshipit-source-id: b0e16a35959a49a2166109068f3e0cbbb836e888
parent 524d5540
...@@ -52,7 +52,7 @@ printf "Installing PyTorch with %s\n" "${cudatoolkit}" ...@@ -52,7 +52,7 @@ printf "Installing PyTorch with %s\n" "${cudatoolkit}"
# 2. Install torchaudio # 2. Install torchaudio
printf "* Installing torchaudio\n" printf "* Installing torchaudio\n"
python setup.py install BUILD_FFMPEG=1 python setup.py install
# 3. Install Test tools # 3. Install Test tools
printf "* Installing test tools\n" printf "* Installing test tools\n"
......
...@@ -40,3 +40,4 @@ conda activate "${env_dir}" ...@@ -40,3 +40,4 @@ conda activate "${env_dir}"
# 3. Install minimal build tools # 3. Install minimal build tools
pip --quiet install cmake ninja pip --quiet install cmake ninja
conda install --quiet -y -c conda-forge 'ffmpeg>4.1' pkg-config
...@@ -17,6 +17,16 @@ endif() ...@@ -17,6 +17,16 @@ endif()
# ffmpeg # ffmpeg
################################################################################ ################################################################################
if (BUILD_FFMPEG) if (BUILD_FFMPEG)
if(WIN32)
message(FATAL_ERROR "FFmpeg integration is not supported on Windows.")
# TODO
# Since pkg-config is not well-supported on Windows (for example, ffmpeg
# installed from conda-forge does not include `.pc` medata file),
# to support windows, we need to fill interface manually.
#
# Something like this might work
# https://github.com/microsoft/vcpkg/issues/1379#issuecomment-312483740
endif()
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET
# requires ffmpeg>=4.1 # requires ffmpeg>=4.1
......
...@@ -137,7 +137,14 @@ void Streamer::seek(double timestamp) { ...@@ -137,7 +137,14 @@ void Streamer::seek(double timestamp) {
int64_t ts = static_cast<int64_t>(timestamp * AV_TIME_BASE); int64_t ts = static_cast<int64_t>(timestamp * AV_TIME_BASE);
int ret = avformat_seek_file(pFormatContext, -1, INT64_MIN, ts, INT64_MAX, 0); int ret = avformat_seek_file(pFormatContext, -1, INT64_MIN, ts, INT64_MAX, 0);
if (ret < 0) { if (ret < 0) {
throw std::runtime_error(std::string("Failed to seek: ") + av_err2str(ret)); // Temporarily removing `av_err2str` function as it causes
// `error: taking address of temporary array` on GCC.
// TODO:
// Workaround with `av_err2string` function from
// https://github.com/joncampbell123/composite-video-simulator/issues/5#issuecomment-611885908
throw std::runtime_error(std::string("Failed to seek."));
// throw std::runtime_error(std::string("Failed to seek: ") +
// av_err2str(ret));
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment