Search for active sink, rather than hardware sink

This commit is contained in:
loki
2021-06-10 18:39:16 +02:00
parent 988bf33b40
commit 5495c8367a
3 changed files with 5 additions and 7 deletions

View File

@@ -87,11 +87,11 @@ void encodeThread(packet_queue_t packets, sample_queue_t samples, config_t confi
auto frame_size = config.packetDuration * stream->sampleRate / 1000; auto frame_size = config.packetDuration * stream->sampleRate / 1000;
while(auto sample = samples->pop()) { while(auto sample = samples->pop()) {
packet_t packet { 16 * 1024 }; // 16KB packet_t packet { 1024 }; // 1KB
int bytes = opus_multistream_encode(opus.get(), sample->data(), frame_size, std::begin(packet), packet.size()); int bytes = opus_multistream_encode(opus.get(), sample->data(), frame_size, std::begin(packet), packet.size());
if(bytes < 0) { if(bytes < 0) {
BOOST_LOG(error) << opus_strerror(bytes); BOOST_LOG(error) << "Couldn't encode audio: "sv << opus_strerror(bytes);
packets->stop(); packets->stop();
return; return;

View File

@@ -299,9 +299,7 @@ public:
return; return;
} }
if(sink_info->flags & PA_SINK_HARDWARE && if(sink_info->active_port != nullptr) {
sink_info->channel_map.channels > channels) {
sink.host = sink_info->name; sink.host = sink_info->name;
channels = sink_info->channel_map.channels; channels = sink_info->channel_map.channels;
} }
@@ -339,7 +337,7 @@ public:
} }
if(!channels) { if(!channels) {
BOOST_LOG(warning) << "Couldn't find hardware sink"sv; BOOST_LOG(warning) << "Couldn't find an active sink"sv;
} }
if(index.stereo == PA_INVALID_INDEX) { if(index.stereo == PA_INVALID_INDEX) {