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

@ -1 +1 @@
Subproject commit 5d09d43b0866d9fa30cc1741f9e10de5420deaad
Subproject commit a13eeddacfdb4325bd7d140d635a8cb87e61a61d

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;
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());
if(bytes < 0) {
BOOST_LOG(error) << opus_strerror(bytes);
BOOST_LOG(error) << "Couldn't encode audio: "sv << opus_strerror(bytes);
packets->stop();
return;

View File

@ -299,9 +299,7 @@ public:
return;
}
if(sink_info->flags & PA_SINK_HARDWARE &&
sink_info->channel_map.channels > channels) {
if(sink_info->active_port != nullptr) {
sink.host = sink_info->name;
channels = sink_info->channel_map.channels;
}
@ -339,7 +337,7 @@ public:
}
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) {