Skip to content

Commit

Permalink
Restrict audio channel conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
darbyjohnston committed Jul 12, 2024
1 parent e4391f0 commit cf04f82
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/tlTimeline/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ namespace tl
if (p.thread.rtAudio && !audioSystem->getDevices().empty())
{
p.audioThread.info = audioSystem->getDefaultOutputInfo();
p.audioThread.info.channelCount = p.getAudioChannelCount(
p.ioInfo.audio,
p.audioThread.info);
if (p.audioThread.info.channelCount > 0 &&
p.audioThread.info.dataType != audio::DataType::None &&
p.audioThread.info.sampleRate > 0)
Expand Down
12 changes: 12 additions & 0 deletions lib/tlTimeline/PlayerPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,18 @@ namespace tl
}
}

size_t Player::Private::getAudioChannelCount(
const audio::Info& input,
const audio::Info& output)
{
size_t out = 2;
if (input.channelCount == output.channelCount)
{
out = output.channelCount;
}
return out;
}

void Player::Private::resetAudioTime()
{
{
Expand Down
3 changes: 3 additions & 0 deletions lib/tlTimeline/PlayerPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ namespace tl
void clearCache();
void cacheUpdate();

static size_t getAudioChannelCount(
const audio::Info& input,
const audio::Info& output);
void resetAudioTime();
#if defined(TLRENDER_AUDIO)
static int rtAudioCallback(
Expand Down

0 comments on commit cf04f82

Please sign in to comment.