Skip to content

Commit 70a9437

Browse files
filipi87aconchillo
authored andcommitted
Sending ignoreAudioLevel to SFU. (#2090)
* Implementing to be able to ignore audio level for custom audio tracks inside daily-core. * Adding support for the ignore audio level inside daily-python * Sending default values for the ignore audio level from android and ios * Fixing cargo clippy and automated tests. * Adding missing ignore_audio_level option to daily-python * Fixing python changelog
1 parent 37968e3 commit 70a9437

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to the **daily-python** SDK will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased
9+
10+
### Added
11+
12+
- Added option to ignore audio level when creating a custom audio track.
13+
814
## [0.19.2] - 2025-06-09
915

1016
### Fixed
@@ -724,3 +730,4 @@ buffer = speaker.read_frames(FRAMES_TO_READ)
724730

725731
- Fixed an issue where virtual devices could cause other Python threads to be
726732
blocked.
733+

daily.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,14 @@ class CallClient:
8989
self,
9090
track_name: str,
9191
audio_track: CustomAudioTrack,
92+
ignore_audio_level: Optional[bool] = None,
9293
completion: Optional[Callable[[Optional[str]], None]] = None,
9394
) -> None: ...
9495
def update_custom_audio_track(
9596
self,
9697
track_name: str,
9798
audio_track: CustomAudioTrack,
99+
ignore_audio_level: Optional[bool] = None,
98100
completion: Optional[Callable[[Optional[str]], None]] = None,
99101
) -> None: ...
100102
def remove_custom_audio_track(

src/call_client.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,12 +600,14 @@ impl PyCallClient {
600600
/// :param str track_name: The audio track name
601601
/// :param audio_track: The custom audio track being added
602602
/// :type audio_track: :class:`CustomAudioTrack`
603+
/// :param Optional bool: If the audio track should be ignored by the SFU when calculating the audio level
603604
/// :param Optional[func] completion: An optional completion callback with one parameter: (:ref:`CallClientError`)
604-
#[pyo3(signature = (track_name, audio_track, completion = None))]
605+
#[pyo3(signature = (track_name, audio_track, ignore_audio_level = None, completion = None))]
605606
pub fn add_custom_audio_track(
606607
&self,
607608
track_name: &str,
608609
audio_track: &PyCustomAudioTrack,
610+
ignore_audio_level: Option<bool>,
609611
completion: Option<PyObject>,
610612
) -> PyResult<()> {
611613
// If we have already been released throw an exception.
@@ -616,12 +618,19 @@ impl PyCallClient {
616618
let request_id =
617619
self.maybe_register_completion(completion.map(PyCallClientCompletion::UnaryFn));
618620

621+
let ignore_audio_level_value = match ignore_audio_level {
622+
Some(true) => 1,
623+
Some(false) => 0,
624+
None => -1,
625+
};
626+
619627
unsafe {
620628
daily_core_call_client_add_custom_audio_track(
621629
call_client.as_mut(),
622630
request_id,
623631
track_name_cstr.as_ptr(),
624632
audio_track.audio_track.as_ptr() as *const _,
633+
ignore_audio_level_value,
625634
);
626635
}
627636

@@ -634,12 +643,14 @@ impl PyCallClient {
634643
/// :param str track_name: The audio track name
635644
/// :param audio_track: The new custom audio track
636645
/// :type audio_track: :class:`CustomAudioTrack`
646+
/// :param Optional bool: If the audio track should be ignored by the SFU when calculating the audio level
637647
/// :param Optional[func] completion: An optional completion callback with one parameter: (:ref:`CallClientError`)
638-
#[pyo3(signature = (track_name, audio_track, completion = None))]
648+
#[pyo3(signature = (track_name, audio_track, ignore_audio_level = None, completion = None))]
639649
pub fn update_custom_audio_track(
640650
&self,
641651
track_name: &str,
642652
audio_track: &PyCustomAudioTrack,
653+
ignore_audio_level: Option<bool>,
643654
completion: Option<PyObject>,
644655
) -> PyResult<()> {
645656
// If we have already been released throw an exception.
@@ -650,12 +661,19 @@ impl PyCallClient {
650661
let request_id =
651662
self.maybe_register_completion(completion.map(PyCallClientCompletion::UnaryFn));
652663

664+
let ignore_audio_level_value = match ignore_audio_level {
665+
Some(true) => 1,
666+
Some(false) => 0,
667+
None => -1,
668+
};
669+
653670
unsafe {
654671
daily_core_call_client_update_custom_audio_track(
655672
call_client.as_mut(),
656673
request_id,
657674
track_name_cstr.as_ptr(),
658675
audio_track.audio_track.as_ptr() as *const _,
676+
ignore_audio_level_value,
659677
);
660678
}
661679

0 commit comments

Comments
 (0)