Skip to content

Commit

Permalink
Roll src/third_party/ffmpeg/ 574c39cce..32b2d1d526 (1125 commits)
Browse files Browse the repository at this point in the history
https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+log/574c39cce323..32b2d1d526

$ git log 574c39cce..32b2d1d526 --date=short --no-merges --format='%ad %ae %s'
2022-04-01 dalecurtis Drop avsscanf.c from the build since we don't use it.
2022-04-01 dalecurtis Update patches README.
2022-04-01 dalecurtis Redisable av_sscanf since it's little used and takes ~8kb.
2022-03-31 dalecurtis Update chromium documentation for M102 ffmpeg roll.
2022-03-31 dalecurtis Fix a couple missed headers.
2022-03-31 dalecurtis Remove stale patches and cleanup UNCHECKED_BITSTREAM_READER.
2022-03-31 dalecurtis Add update configs for m102 ffmpeg roll.
2022-03-31 dalecurtis Update scripts to work with latest ffmpeg, python3, win build changes.
2022-03-31 onemda avfilter/af_join: do not dereference possible null pointer
2022-03-30 lance.lmwang doc/bitstream_filters: fix for the syntax of code
2022-03-26 martin test: tiny_ssim: Don't include config.h
2022-03-29 martin vc1dsp: Change remaining stride parameters to ptrdiff_t
2021-08-14 quinkblack avformat/libsrt: use a larger buffer for find_info_tag
2022-03-25 quinkblack avformat/libsrt: fix deprecated warning
2022-03-25 dcnieho avdevice/dshow: fix regression
2022-03-18 jamrial avcodec/wmalosslessdec: ensure channel count in the private context and decoder context are consistent
2022-03-25 onemda avfilter/f_realtime: add support for commands
2022-03-28 michael avcodec/binkaudio: reset ch_offset on errors
2022-03-28 git MAINTAINERS: add Niklas Haas for vf_libplacebo.c
2022-03-21 michael avcodec/vmdaudio: Fix channels count bug
2022-03-28 jamrial swresample/rematrix: fix typo in clean_layout()
2022-03-22 jamrial avfilter/buffersrc: uninitialize the context ch_layout before overwritting it
2022-03-20 michael avformat/aqtitledec: Skip unrepresentable durations
2022-03-20 michael avformat/apm: Check channels
2022-03-19 michael avformat/cafdec: Do not store empty keys in read_info_chunk()
2022-03-25 michael avformat: Do not search through the AVOption table for a option not in it repeatedly on each packet
2022-03-19 michael avformat/alp: Check num_channels
2022-03-23 robux4 dxva2_hevc: don't use frames as reference if they are not marked as such
2022-03-22 kevmo314 rtpenc_vp8: Use 15-bit PictureIDs
2021-10-03 wwakabot avfilter/vf_subtitles: add additional font mime types
2022-03-25 jamrial avutil/channel_layout: return earlier on UNSPEC layouts in av_channel_layout_subset()
2022-03-25 jamrial avutil/tests/channel_layout: also test ambisonic layouts in av_channel_layout_subset()
2022-03-21 andreas.rheinhardt doc/examples/muxing: Remove outdated comment
2022-03-24 andreas.rheinhardt avcodec/error_resilience: Remove write only ERContext.ref_count
2022-03-24 andreas.rheinhardt avcodec/h264dec: Constify slices' pointer to the parent context
2022-03-24 andreas.rheinhardt avcodec/h264dec: Move ERContext to H264Context
2022-03-24 andreas.rheinhardt avcodec/h264_slice: Fix decoding undamaged input with slices
2022-03-25 onemda avfilter/vsrc_life: set outlink frame_rate
2022-03-25 onemda avfilter/vsrc_cellauto: set outlink frame_rate
2022-03-25 onemda avfilter/vsrc_mandelbrot: set outlink frame_rate
2022-03-25 onemda avfilter/vsrc_mandelbrot: rename misleading variable
2022-03-25 onemda avfilter/vsrc_mptestsrc: set outlink frame_rate
2022-03-25 onemda avfilter/vsrc_gradients: set outlink frame_rate
2022-03-25 onemda avfilter/vsrc_gradients: rename misleading variable
2022-03-25 onemda avfilter/vsrc_sierpinski: set frame_rate to outlink
2022-03-25 onemda avfilter/vsrc_sierpinski: rename misleading variable
2022-03-17 onemda fate: add crystalizer test
2022-03-25 jamrial avutil/tests/channel_layout: test av_channel_layout_check()
2022-03-25 jamrial avutil/tests/channel_layout: test the output of av_channel_layout_subset()
2022-03-25 jamrial avutil/tests/channel_layout: test the output of av_channel_layout_standard()
2022-03-25 jamrial avutil/tests/channel_layout: test generating a custom layout using ambisonic channels and a non diegetic channel with a custom name
2022-03-25 jamrial doc/utils: add missing 22.2 layout entry
2022-03-25 jamrial avutil/channel_layout: add missing check for AV_CHAN_NONE in av_channel_description
(...)
2022-01-24 haihao.xiang lavc/qsvdec: track the runtime session version
2022-01-24 haihao.xiang lavc/qsv: allow to add more parameter buffers to QSV frame
2022-01-13 haihao.xiang-at-intel.com lavc/qsvenc: add tile encoding support for VP9
2022-01-11 nst799610810 libavutil/hwcontext_opencl: fix a bug for mapping qsv frame to opencl
2022-01-11 wenbin.chen-at-intel.com libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface
2022-01-29 dev x86/tx_float: mark AVX2 functions as AVXSLOW
2022-01-29 dev lavu/tx: do not unconditionally free subcontexts if initialization fails
2022-01-29 dev lavu/tx: reset subcontext pointer if initialization fails
2022-01-28 dev lavu/tx: print debug info even if no transforms are found
2022-01-28 liuqi05 avutil/tx: add null pointer check after av_mallocz
2022-01-28 liuqi05 avutil/tx: remove deadcode of the control flow
2022-01-27 dev hwcontext_vulkan: avoid using 64-bit enums
2022-01-27 dev lavu/tx: avoid using 64-bit enums
2022-01-27 quinkblack configure: add libplacebo to help message
2022-01-25 wenbin.chen-at-intel.com libavcodec/qsvenc: Add intra refresh to hevc_qsv and add new intra refresh parameter
2022-01-25 wenbin.chen-at-intel.com libavcodec/qsvenc: Add b_strategy option to hevc_qsv
2022-01-25 wenbin.chen-at-intel.com libavcodec/qsvenc: Add max slice size support to hevc_qsv
2022-01-26 andreas.rheinhardt avcodec/h264data: Add missing rational.h inclusion
2022-01-27 dev x86/tx_float: add missing FF_TX_OUT_OF_PLACE flag to functions
2022-01-27 dev lavu/tx: clean up CPU flags check
2022-01-26 dev x86/tx_float: do not build tx_float_init.c if x86 assembly is disabled
2022-01-24 andreas.rheinhardt avcodec/h264_parse: Move ff_h264_get_profile() to h264_ps.h
2022-01-24 andreas.rheinhardt avcodec/h264_*: Remove unnecessary internal.h inclusions
2022-01-24 andreas.rheinhardt avcodec/h264dec: Remove unnecessary headers
2022-01-24 andreas.rheinhardt avcodec/h264*: Remove unnecessary h264_mvpred.h inclusions
2022-01-24 anton lavc/svq3: stop including h264dec.h
2022-01-24 anton lavc/x86/h264_qpel: stop unnecessarily including h264dec
2022-01-24 anton lavc/vdpau: stop unnecessarily including h264dec
2022-01-24 anton lavc/h264: move MB_TYPE defs from h264dec.h to h264_parse
2022-01-24 anton lavc/h264_parse: stop including h264dec.h
2022-01-24 anton lavc/h264data.h: stop including h264dec.h
2022-01-24 anton lavc/h264: move some shared code from h264dec to h264_parse
2022-01-24 anton lavc/h264_parser: add missing headers
2022-01-24 anton lavc/h264: replace MAX_DELAYED_PIC_COUNT by H264_MAX_DPB_FRAMES
2022-01-24 anton lavc/h264: replace MAX_DELAYED_PIC_COUNT with FF_ARRAY_ELEMS where appropriate
2022-01-24 anton lavc/h264dec.h: Move MMCOOpcode to h264_parse.h
2022-01-24 anton lavc/h264: replace MAX_MMCO_COUNT with H264_MAX_MMCO_COUNT
2022-01-24 andreas.rheinhardt avcodec/h264dec: Move pack8to16 to its only user
2022-01-24 andreas.rheinhardt avcodec/h264dec: Move find_start_code() to its only user
2022-01-26 dev lavu/tx: do not mix declarations and code
2022-01-25 dev x86/tx_float: add permute-free FFT versions
2022-01-25 dev lavu: bump minor and add APIchanges for new lavu/tx additions
2022-01-21 dev lavu/tx: add an RDFT implementation
2022-01-20 dev lavu/tx: rewrite internal code as a tree-based codelet constructor
2022-01-25 dev lavu/tx: improve documentation for existing transforms
2022-01-24 jamrial avcodec/h264_parser: don't alter decoder private data
2021-12-20 jan.ekstrom tests: add test for ffmpeg's fix_sub_duration feature
2022-01-24 ffmpeg doc/filters: note format constraint for volumedetect
2022-01-20 wenbin.chen-at-intel.com libavcodec/qsvenc: fix a memory leak problem
2021-12-24 kswanson avfilter/vf_libvmaf: update filter for libvmaf v2.0.0

Created with:
  roll-dep src/third_party/ffmpeg

Fixed: 1293918
Cq-Include-Trybots: luci.chromium.try:mac_chromium_asan_rel_ng,linux_chromium_asan_rel_ng,linux_chromium_chromeos_asan_rel_ng
Change-Id: I41945d0f963e3d1f65940067bac22f63b68e37d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3565647
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Dan Sanders <sandersd@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#988253}
  • Loading branch information
dalecurtis authored and Chromium LUCI CQ committed Apr 2, 2022
1 parent a5261ee commit 6e554a3
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 38 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ deps = {
Var('chromium_git') + '/external/github.com/google/farmhash.git' + '@' + '816a4ae622e964763ca0862d9dbd19324a1eaf45',

'src/third_party/ffmpeg':
Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + '574c39cce3231c69bc9a02ac475c27d944bdb113',
Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + '32b2d1d52612e47531df9289e3f5fdd5447507dd',

'src/third_party/flac':
Var('chromium_git') + '/chromium/deps/flac.git' + '@' + 'af862024c8c8fa0ae07ced05e89013d881b00596',
Expand Down
29 changes: 16 additions & 13 deletions media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void CdmAudioDecoderConfigToAVCodecContext(
codec_context->sample_fmt = AV_SAMPLE_FMT_NONE;
}

codec_context->channels = config.channel_count;
codec_context->ch_layout.nb_channels = config.channel_count;
codec_context->sample_rate = config.samples_per_second;

if (config.extra_data) {
Expand Down Expand Up @@ -124,8 +124,8 @@ void CopySamples(cdm::AudioFormat cdm_format,
case cdm::kAudioFormatPlanarS16:
case cdm::kAudioFormatPlanarF32: {
const int decoded_size_per_channel =
decoded_audio_size / av_frame.channels;
for (int i = 0; i < av_frame.channels; ++i) {
decoded_audio_size / av_frame.ch_layout.nb_channels;
for (int i = 0; i < av_frame.ch_layout.nb_channels; ++i) {
memcpy(output_buffer, av_frame.extended_data[i],
decoded_size_per_channel);
output_buffer += decoded_size_per_channel;
Expand Down Expand Up @@ -185,13 +185,14 @@ bool FFmpegCdmAudioDecoder::Initialize(
// Success!
decoding_loop_ = std::make_unique<FFmpegDecodingLoop>(codec_context_.get());
samples_per_second_ = config.samples_per_second;
bytes_per_frame_ = codec_context_->channels * config.bits_per_channel / 8;
bytes_per_frame_ =
codec_context_->ch_layout.nb_channels * config.bits_per_channel / 8;
output_timestamp_helper_ =
std::make_unique<AudioTimestampHelper>(config.samples_per_second);
is_initialized_ = true;

// Store initial values to guard against midstream configuration changes.
channels_ = codec_context_->channels;
channels_ = codec_context_->ch_layout.nb_channels;
av_sample_format_ = codec_context_->sample_fmt;

return true;
Expand Down Expand Up @@ -291,17 +292,19 @@ cdm::Status FFmpegCdmAudioDecoder::DecodeBuffer(
for (auto& frame : audio_frames) {
int decoded_audio_size = 0;
if (frame->sample_rate != samples_per_second_ ||
frame->channels != channels_ || frame->format != av_sample_format_) {
frame->ch_layout.nb_channels != channels_ ||
frame->format != av_sample_format_) {
DLOG(ERROR) << "Unsupported midstream configuration change!"
<< " Sample Rate: " << frame->sample_rate << " vs "
<< samples_per_second_ << ", Channels: " << frame->channels
<< " vs " << channels_ << ", Sample Format: " << frame->format
<< " vs " << av_sample_format_;
<< samples_per_second_
<< ", Channels: " << frame->ch_layout.nb_channels << " vs "
<< channels_ << ", Sample Format: " << frame->format << " vs "
<< av_sample_format_;
return cdm::kDecodeError;
}

decoded_audio_size = av_samples_get_buffer_size(
nullptr, codec_context_->channels, frame->nb_samples,
nullptr, codec_context_->ch_layout.nb_channels, frame->nb_samples,
codec_context_->sample_fmt, 1);
if (!decoded_audio_size)
continue;
Expand All @@ -320,9 +323,9 @@ bool FFmpegCdmAudioDecoder::OnNewFrame(
size_t* total_size,
std::vector<std::unique_ptr<AVFrame, ScopedPtrAVFreeFrame>>* audio_frames,
AVFrame* frame) {
*total_size += av_samples_get_buffer_size(nullptr, codec_context_->channels,
frame->nb_samples,
codec_context_->sample_fmt, 1);
*total_size += av_samples_get_buffer_size(
nullptr, codec_context_->ch_layout.nb_channels, frame->nb_samples,
codec_context_->sample_fmt, 1);
audio_frames->emplace_back(av_frame_clone(frame));
return true;
}
Expand Down
11 changes: 6 additions & 5 deletions media/ffmpeg/ffmpeg_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,11 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context,
codec_context->sample_fmt, codec_context->codec_id);

ChannelLayout channel_layout =
codec_context->channels > 8
codec_context->ch_layout.nb_channels > 8
? CHANNEL_LAYOUT_DISCRETE
: ChannelLayoutToChromeChannelLayout(codec_context->channel_layout,
codec_context->channels);
: ChannelLayoutToChromeChannelLayout(
codec_context->ch_layout.u.mask,
codec_context->ch_layout.nb_channels);

int sample_rate = codec_context->sample_rate;
switch (codec) {
Expand Down Expand Up @@ -401,7 +402,7 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context,
extra_data, encryption_scheme, seek_preroll,
codec_context->delay);
if (channel_layout == CHANNEL_LAYOUT_DISCRETE)
config->SetChannelsForDiscrete(codec_context->channels);
config->SetChannelsForDiscrete(codec_context->ch_layout.nb_channels);

#if BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO)
// These are bitstream formats unknown to ffmpeg, so they don't have
Expand Down Expand Up @@ -470,7 +471,7 @@ void AudioDecoderConfigToAVCodecContext(const AudioDecoderConfig& config,

// TODO(scherkus): should we set |channel_layout|? I'm not sure if FFmpeg uses
// said information to decode.
codec_context->channels = config.channels();
codec_context->ch_layout.nb_channels = config.channels();
codec_context->sample_rate = config.samples_per_second();

if (config.extra_data().empty()) {
Expand Down
9 changes: 5 additions & 4 deletions media/filters/audio_file_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,15 @@ bool AudioFileReader::OpenDecoder() {

// Verify the channel layout is supported by Chrome. Acts as a sanity check
// against invalid files. See http://crbug.com/171962
if (ChannelLayoutToChromeChannelLayout(codec_context_->channel_layout,
codec_context_->channels) ==
if (ChannelLayoutToChromeChannelLayout(
codec_context_->ch_layout.u.mask,
codec_context_->ch_layout.nb_channels) ==
CHANNEL_LAYOUT_UNSUPPORTED) {
return false;
}

// Store initial values to guard against midstream configuration changes.
channels_ = codec_context_->channels;
channels_ = codec_context_->ch_layout.nb_channels;
audio_codec_ = CodecIDToAudioCodec(codec_context_->codec_id);
sample_rate_ = codec_context_->sample_rate;
av_sample_format_ = codec_context_->sample_fmt;
Expand Down Expand Up @@ -223,7 +224,7 @@ bool AudioFileReader::OnNewFrame(
if (frames_read < 0)
return false;

const int channels = frame->channels;
const int channels = frame->ch_layout.nb_channels;
if (frame->sample_rate != sample_rate_ || channels != channels_ ||
frame->format != av_sample_format_) {
DLOG(ERROR) << "Unsupported midstream configuration change!"
Expand Down
6 changes: 3 additions & 3 deletions media/filters/audio_file_reader_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ class AudioFileReaderTest : public testing::Test {
EXPECT_FALSE(reader_->Open());
}

void RunTestFailingDecode(const char* fn) {
void RunTestFailingDecode(const char* fn, int expect_read = 0) {
Initialize(fn);
EXPECT_TRUE(reader_->Open());
std::vector<std::unique_ptr<AudioBus>> decoded_audio_packets;
EXPECT_EQ(reader_->Read(&decoded_audio_packets), 0);
EXPECT_EQ(reader_->Read(&decoded_audio_packets), expect_read);
}

void RunTestPartialDecode(const char* fn) {
Expand Down Expand Up @@ -219,7 +219,7 @@ TEST_F(AudioFileReaderTest, AAC_ADTS) {
}

TEST_F(AudioFileReaderTest, MidStreamConfigChangesFail) {
RunTestFailingDecode("midstream_config_change.mp3");
RunTestFailingDecode("midstream_config_change.mp3", 42624);
}
#endif

Expand Down
11 changes: 9 additions & 2 deletions media/filters/audio_video_metadata_extractor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ bool AudioVideoMetadataExtractor::Extract(DataSource* source,
if (!stream)
continue;

void* display_matrix =
av_stream_get_side_data(stream, AV_PKT_DATA_DISPLAYMATRIX, nullptr);
if (display_matrix) {
rotation_ = VideoTransformation::FromFFmpegDisplayMatrix(
static_cast<int32_t*>(display_matrix))
.rotation;
info.tags["rotate"] = base::NumberToString(rotation_);
}

// Extract dictionary from streams also. Needed for containers that attach
// metadata to contained streams instead the container itself, like OGG.
ExtractDictionary(stream->metadata, &info.tags);
Expand Down Expand Up @@ -255,8 +264,6 @@ void AudioVideoMetadataExtractor::ExtractDictionary(AVDictionary* metadata,
if (raw_tags->find(tag->key) == raw_tags->end())
(*raw_tags)[tag->key] = tag->value;

if (ExtractInt(tag, "rotate", &rotation_))
continue;
if (ExtractString(tag, "album", &album_))
continue;
if (ExtractString(tag, "artist", &artist_))
Expand Down
7 changes: 4 additions & 3 deletions media/filters/ffmpeg_aac_bitstream_converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,15 @@ bool FFmpegAACBitstreamConverter::ConvertPacket(AVPacket* packet) {
if (!header_generated_ || codec_ != stream_codec_parameters_->codec_id ||
audio_profile_ != stream_codec_parameters_->profile ||
sample_rate_index_ != sample_rate_index ||
channel_configuration_ != stream_codec_parameters_->channels ||
channel_configuration_ !=
stream_codec_parameters_->ch_layout.nb_channels ||
frame_length_ != header_plus_packet_size) {
header_generated_ =
GenerateAdtsHeader(stream_codec_parameters_->codec_id,
0, // layer
stream_codec_parameters_->profile, sample_rate_index,
0, // private stream
stream_codec_parameters_->channels,
stream_codec_parameters_->ch_layout.nb_channels,
0, // originality
0, // home
0, // copyrighted_stream
Expand All @@ -214,7 +215,7 @@ bool FFmpegAACBitstreamConverter::ConvertPacket(AVPacket* packet) {
codec_ = stream_codec_parameters_->codec_id;
audio_profile_ = stream_codec_parameters_->profile;
sample_rate_index_ = sample_rate_index;
channel_configuration_ = stream_codec_parameters_->channels;
channel_configuration_ = stream_codec_parameters_->ch_layout.nb_channels;
frame_length_ = header_plus_packet_size;
}

Expand Down
2 changes: 1 addition & 1 deletion media/filters/ffmpeg_aac_bitstream_converter_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class FFmpegAACBitstreamConverterTest : public testing::Test {
memset(&test_parameters_, 0, sizeof(AVCodecParameters));
test_parameters_.codec_id = AV_CODEC_ID_AAC;
test_parameters_.profile = FF_PROFILE_AAC_MAIN;
test_parameters_.channels = 2;
test_parameters_.ch_layout.nb_channels = 2;
test_parameters_.extradata = extradata_header_;
test_parameters_.extradata_size = sizeof(extradata_header_);
}
Expand Down
13 changes: 7 additions & 6 deletions media/filters/ffmpeg_audio_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace media {

// Return the number of channels from the data in |frame|.
static inline int DetermineChannels(AVFrame* frame) {
return frame->channels;
return frame->ch_layout.nb_channels;
}

// Called by FFmpeg's allocation routine to allocate a buffer. Uses
Expand Down Expand Up @@ -231,7 +231,7 @@ bool FFmpegAudioDecoder::OnNewFrame(const DecoderBuffer& buffer,
// Translate unsupported into discrete layouts for discrete configurations;
// ffmpeg does not have a labeled discrete configuration internally.
ChannelLayout channel_layout = ChannelLayoutToChromeChannelLayout(
codec_context_->channel_layout, codec_context_->channels);
codec_context_->ch_layout.u.mask, codec_context_->ch_layout.nb_channels);
if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED &&
config_.channel_layout() == CHANNEL_LAYOUT_DISCRETE) {
channel_layout = CHANNEL_LAYOUT_DISCRETE;
Expand Down Expand Up @@ -348,11 +348,11 @@ bool FFmpegAudioDecoder::ConfigureDecoder(const AudioDecoderConfig& config) {
// Success!
av_sample_format_ = codec_context_->sample_fmt;

if (codec_context_->channels != config.channels()) {
if (codec_context_->ch_layout.nb_channels != config.channels()) {
MEDIA_LOG(ERROR, media_log_)
<< "Audio configuration specified " << config.channels()
<< " channels, but FFmpeg thinks the file contains "
<< codec_context_->channels << " channels";
<< codec_context_->ch_layout.nb_channels << " channels";
ReleaseFFmpegResources();
state_ = DecoderState::kUninitialized;
return false;
Expand Down Expand Up @@ -403,7 +403,7 @@ int FFmpegAudioDecoder::GetAudioBuffer(struct AVCodecContext* s,
if (frame->nb_samples <= 0)
return AVERROR(EINVAL);

if (s->channels != channels) {
if (s->ch_layout.nb_channels != channels) {
DLOG(ERROR) << "AVCodecContext and AVFrame disagree on channel count.";
return AVERROR(EINVAL);
}
Expand Down Expand Up @@ -436,7 +436,8 @@ int FFmpegAudioDecoder::GetAudioBuffer(struct AVCodecContext* s,
ChannelLayout channel_layout =
config_.channel_layout() == CHANNEL_LAYOUT_DISCRETE
? CHANNEL_LAYOUT_DISCRETE
: ChannelLayoutToChromeChannelLayout(s->channel_layout, s->channels);
: ChannelLayoutToChromeChannelLayout(s->ch_layout.u.mask,
s->ch_layout.nb_channels);

if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) {
DLOG(ERROR) << "Unsupported channel layout.";
Expand Down

0 comments on commit 6e554a3

Please sign in to comment.