Skip to content

Commit 3fc010d

Browse files
committed
return RenderCapacity as owned value
1 parent cc7a6c1 commit 3fc010d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/capacity.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ impl AudioRenderCapacityEvent {
6565
/// Ideally the load value is below 1.0, meaning that it took less time to render the audio than it
6666
/// took to play it out. An audio buffer underrun happens when this load value is greater than 1.0: the
6767
/// system could not render audio fast enough for real-time.
68+
#[derive(Clone)]
6869
pub struct AudioRenderCapacity {
6970
context: ConcreteBaseAudioContext,
7071
receiver: Receiver<AudioRenderCapacityLoad>,

src/context/online.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@ impl AudioContext {
268268
self.backend_manager.lock().unwrap().sink_id().to_owned()
269269
}
270270

271+
/// Returns an [`AudioRenderCapacity`] instance associated with an AudioContext.
272+
#[must_use]
273+
pub fn render_capacity(&self) -> AudioRenderCapacity {
274+
self.render_capacity.clone()
275+
}
276+
271277
/// Update the current audio output device.
272278
///
273279
/// The provided `sink_id` string must match a device name `enumerate_devices_sync`.
@@ -712,12 +718,6 @@ impl AudioContext {
712718
let opts = node::MediaElementAudioSourceOptions { media_element };
713719
node::MediaElementAudioSourceNode::new(self, opts)
714720
}
715-
716-
/// Returns an [`AudioRenderCapacity`] instance associated with an AudioContext.
717-
#[must_use]
718-
pub fn render_capacity(&self) -> &AudioRenderCapacity {
719-
&self.render_capacity
720-
}
721721
}
722722

723723
#[cfg(test)]

0 commit comments

Comments
 (0)