试图解决编译错误

This commit is contained in:
Mike Solar
2025-06-18 08:54:06 +08:00
parent 7e0e94abf6
commit 5f9508434f
7 changed files with 35 additions and 32 deletions
+7 -8
View File
@@ -349,7 +349,7 @@ bool FFmpegEncoder::WriteAudioData(const AudioParams &audio_params, const uint8_
av_samples_copy(audio_frame_->data, output_data, audio_frame_offset_, i,
copy_length,
audio_frame_->channels, static_cast<AVSampleFormat>(audio_frame_->format));
audio_frame_->ch_layout.nb_channels, static_cast<AVSampleFormat>(audio_frame_->format));
audio_frame_offset_ += copy_length;
i += copy_length;
@@ -690,8 +690,7 @@ bool FFmpegEncoder::InitializeStream(AVMediaType type, AVStream** stream_ptr, AV
// Assume audio stream
codec_ctx->sample_rate = params().audio_params().sample_rate();
codec_ctx->channel_layout = params().audio_params().channel_layout();
codec_ctx->channels = av_get_channel_layout_nb_channels(codec_ctx->channel_layout);
codec_ctx->ch_layout = params().audio_params().channel_layout();
codec_ctx->sample_fmt = FFmpegUtils::GetFFmpegSampleFormat(params().audio_params().format());
codec_ctx->time_base = {1, codec_ctx->sample_rate};
@@ -827,13 +826,13 @@ bool FFmpegEncoder::InitializeResampleContext(const AudioParams &audio)
if (audio_resample_ctx_) {
return true;
}
AVChannelLayout layout=audio.channel_layout();
// Create resample context
audio_resample_ctx_ = swr_alloc_set_opts(nullptr,
static_cast<int64_t>(audio_codec_ctx_->channel_layout),
swr_alloc_set_opts2(&audio_resample_ctx_,
&audio_codec_ctx_->ch_layout,
audio_codec_ctx_->sample_fmt,
audio_codec_ctx_->sample_rate,
static_cast<int64_t>(audio.channel_layout()),
&layout,
FFmpegUtils::GetFFmpegSampleFormat(audio.format()),
audio.sample_rate(),
0,
@@ -865,7 +864,7 @@ bool FFmpegEncoder::InitializeResampleContext(const AudioParams &audio)
return false;
}
audio_frame_->channel_layout = audio_codec_ctx_->channel_layout;
audio_frame_->ch_layout = audio_codec_ctx_->ch_layout;
audio_frame_->format = audio_codec_ctx_->sample_fmt;
audio_frame_->nb_samples = audio_max_samples_;