Skip to content

Commit

Permalink
Update maximum adaptive bitrate dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerp committed Sep 14, 2022
1 parent 1a4eb48 commit b051aea
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions alvr/server/cpp/alvr_server/alvr_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,9 @@ void SetButton(unsigned long long path, AlvrButtonValue value) {
g_driver_provider.right_controller->SetButton(path, value);
}
}

void SetAdaptiveBitrateMax(unsigned long long bitrate_max) {
if (g_driver_provider.hmd && g_driver_provider.hmd->m_Listener) {
g_driver_provider.hmd->m_Listener->m_Statistics->m_adaptiveBitrateMaximum = bitrate_max;
}
}
2 changes: 2 additions & 0 deletions alvr/server/cpp/alvr_server/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,5 @@ extern "C" void SetChaperone(float areaWidth, float areaHeight);
extern "C" void SetViewsConfig(ViewsConfigData config);
extern "C" void SetBattery(unsigned long long topLevelPath, float gauge_value, bool is_plugged);
extern "C" void SetButton(unsigned long long path, AlvrButtonValue value);

extern "C" void SetAdaptiveBitrateMax(unsigned long long bitrate_max);
8 changes: 8 additions & 0 deletions alvr/server/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,14 @@ async fn connection_pipeline() -> StrResult {
break Ok(());
}
time::sleep(NETWORK_KEEPALIVE_INTERVAL).await;

// copy some settings periodically into c++

if let Switch::Enabled(config) =
&SERVER_DATA_MANAGER.read().settings().video.adaptive_bitrate
{
unsafe { crate::SetAdaptiveBitrateMax(config.bitrate_maximum) };
}
}
}
};
Expand Down

0 comments on commit b051aea

Please sign in to comment.