Skip to content

Commit

Permalink
Merge pull request ddnet#8614 from Robyt3/Video-Removed-Property-Fix
Browse files Browse the repository at this point in the history
Fix assertion when rendering demo with updated ffmpeg library
  • Loading branch information
def- authored Jul 18, 2024
2 parents c4fca3e + c30a35a commit e74f17c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/engine/client/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,15 +826,19 @@ bool CVideo::OpenAudio()
}

/* set options */
dbg_assert(av_opt_set_int(m_AudioStream.m_vpSwrContexts[i], "in_channel_count", 2, 0) == 0, "invalid option");
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 24, 100)
dbg_assert(av_opt_set_chlayout(m_AudioStream.m_vpSwrContexts[i], "in_chlayout", &pContext->ch_layout, 0) == 0, "invalid option");
#else
dbg_assert(av_opt_set_int(m_AudioStream.m_vpSwrContexts[i], "in_channel_count", pContext->channels, 0) == 0, "invalid option");
#endif
if(av_opt_set_int(m_AudioStream.m_vpSwrContexts[i], "in_sample_rate", m_pSound->MixingRate(), 0) != 0)
{
log_error("videorecorder", "Could not set audio sample rate to %d", m_pSound->MixingRate());
return false;
}
dbg_assert(av_opt_set_sample_fmt(m_AudioStream.m_vpSwrContexts[i], "in_sample_fmt", AV_SAMPLE_FMT_S16, 0) == 0, "invalid option");
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 24, 100)
dbg_assert(av_opt_set_int(m_AudioStream.m_vpSwrContexts[i], "out_channel_count", pContext->ch_layout.nb_channels, 0) == 0, "invalid option");
dbg_assert(av_opt_set_chlayout(m_AudioStream.m_vpSwrContexts[i], "out_chlayout", &pContext->ch_layout, 0) == 0, "invalid option");
#else
dbg_assert(av_opt_set_int(m_AudioStream.m_vpSwrContexts[i], "out_channel_count", pContext->channels, 0) == 0, "invalid option");
#endif
Expand Down

0 comments on commit e74f17c

Please sign in to comment.