|
Sunshine master
Self-hosted game stream host for Moonlight.
|
Definitions for audio capture and encoding. More...
#include <thread>#include <opus/opus_multistream.h>#include "audio.h"#include "config.h"#include "globals.h"#include "logging.h"#include "platform/common.h"#include "thread_safe.h"#include "utility.h"Typedefs | |
| using | audio::opus_t = util::safe_ptr<OpusMSEncoder, opus_multistream_encoder_destroy> |
| Owning pointer for an Opus multistream encoder. | |
| using | audio::sample_queue_t = std::shared_ptr<safe::queue_t<std::vector<float>>> |
| Shared queue carrying captured PCM sample buffers to the encoder thread. | |
Functions | |
| void | audio::capture (safe::mail_t mail, config_t config, void *channel_data) |
| Run the capture loop for this backend. | |
| void | audio::encodeThread (sample_queue_t samples, config_t config, void *channel_data) |
| Encode captured PCM samples into Opus packets on the audio worker thread. | |
| audio_ctx_ref_t | audio::get_audio_ctx_ref () |
| Get the reference to the audio context. | |
| bool | audio::is_audio_ctx_sink_available (const audio_ctx_t &ctx) |
| Check if the audio sink held by audio context is available. | |
| int | audio::map_stream (int channels, bool quality) |
| Select the Opus stream configuration for a channel count and quality tier. | |
Variables | |
| constexpr auto | audio::SAMPLE_RATE = 48000 |
| Audio sample rate in hertz required by Opus. | |
| opus_stream_config_t | audio::stream_configs [MAX_STREAM_CONFIG] |
| Opus stream layouts and bitrates advertised to clients. | |
Definitions for audio capture and encoding.
| void audio::capture | ( | safe::mail_t | mail, |
| config_t | config, | ||
| void * | channel_data ) |
Run the capture loop for this backend.
Capture, encode, and publish audio packets for a stream.
| Mailbox used to publish encoded audio packets. | |
| config | Audio capture and encoder settings. |
| channel_data | Platform-specific capture channel pointer. |
| void audio::encodeThread | ( | sample_queue_t | samples, |
| config_t | config, | ||
| void * | channel_data ) |
Encode captured PCM samples into Opus packets on the audio worker thread.
| samples | Queue of captured PCM sample buffers to encode. |
| config | Audio stream settings negotiated with the client. |
| channel_data | Platform-specific audio capture context passed to packet metadata. |
| audio_ctx_ref_t audio::get_audio_ctx_ref | ( | ) |
Get the reference to the audio context.
*Examples**
| bool audio::is_audio_ctx_sink_available | ( | const audio_ctx_t & | ctx | ) |
Check if the audio sink held by audio context is available.
*Examples**
| ctx | Native context object used by the operation or callback. |
| int audio::map_stream | ( | int | channels, |
| bool | quality ) |
Select the Opus stream configuration for a channel count and quality tier.
| channels | Number of audio channels in the stream. |
| quality | Whether the high-quality Opus layout should be selected. |
stream_configs for the requested layout.