Commit 3212a257 authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

Resolve the usage of deprecated method (#3149)

Summary:
FFmpeg 5 introduced a new API for channel configuration and channel_layout is deprecated.

This commit fixes one of the deprecated messages.

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

Reviewed By: nateanl

Differential Revision: D43874808

Pulled By: mthrok

fbshipit-source-id: 3e76e8c8f1f34758b1014a426e77260e663b18ee
parent 1923be04
...@@ -184,8 +184,15 @@ int FilterGraph::get_output_sample_rate() const { ...@@ -184,8 +184,15 @@ int FilterGraph::get_output_sample_rate() const {
int FilterGraph::get_output_channels() const { int FilterGraph::get_output_channels() const {
TORCH_INTERNAL_ASSERT(buffersink_ctx, "FilterGraph is not initialized."); TORCH_INTERNAL_ASSERT(buffersink_ctx, "FilterGraph is not initialized.");
// Since FFmpeg 5.1
// https://github.com/FFmpeg/FFmpeg/blob/release/5.1/doc/APIchanges#L45-L54
#if LIBAVFILTER_VERSION_MAJOR >= 8 && LIBAVFILTER_VERSION_MINOR >= 44
return buffersink_ctx->inputs[0]->ch_layout.nb_channels;
#else
// Before FFmpeg 5.1
return av_get_channel_layout_nb_channels( return av_get_channel_layout_nb_channels(
buffersink_ctx->inputs[0]->channel_layout); buffersink_ctx->inputs[0]->channel_layout);
#endif
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
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