LiveKit C++ SDK
Real-time audio/video SDK for C++
Loading...
Searching...
No Matches
local_audio_track.h
1/*
2 * Copyright 2025 LiveKit
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an “AS IS” BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include "audio_frame.h"
20#include "local_track_publication.h"
21#include "track.h"
22#include <memory>
23#include <string>
24
25namespace livekit {
26
27namespace proto {
28class OwnedTrack;
29}
30
31class AudioSource;
32
53class LocalAudioTrack : public Track {
54public:
64 static std::shared_ptr<LocalAudioTrack>
65 createLocalAudioTrack(const std::string &name,
66 const std::shared_ptr<AudioSource> &source);
67
72 void mute();
73
75 void unmute();
76
79 std::string to_string() const;
80
83 std::shared_ptr<LocalTrackPublication> publication() const noexcept {
84 return local_publication_;
85 }
86
88 void setPublication(const std::shared_ptr<LocalTrackPublication>
89 &publication) noexcept override {
90 local_publication_ = std::move(publication);
91 }
92
93private:
94 explicit LocalAudioTrack(FfiHandle handle, const proto::OwnedTrack &track);
95
98 std::shared_ptr<LocalTrackPublication> local_publication_;
99};
100
101} // namespace livekit
RAII wrapper for an FFI handle (uintptr_t) coming from Rust.
Definition ffi_handle.h:29
Definition local_audio_track.h:53
static std::shared_ptr< LocalAudioTrack > createLocalAudioTrack(const std::string &name, const std::shared_ptr< AudioSource > &source)
std::string to_string() const
void unmute()
Unmutes the audio track and resumes sending audio to the room.
std::shared_ptr< LocalTrackPublication > publication() const noexcept
Definition local_audio_track.h:83
void setPublication(const std::shared_ptr< LocalTrackPublication > &publication) noexcept override
Sets the publication that owns this track.
Definition local_audio_track.h:88
Definition track.h:73