285{
287 chrono::steady_clock::time_point next_frame_time = chrono::steady_clock::now();
288
291
293 this_thread::sleep_until(next_frame_time);
294 next_frame_time += interval;
295 auto now = chrono::steady_clock::now();
296
297
298 if (next_frame_time < now) {
300 next_frame_time = now;
301 }
302
304
306 {
309 } else {
310 ++it;
311 }
312 }
313
316 vector<audio_frame2> participant_frames(
participants.size());
317 int participant_index = 0;
318
319
322 static_assert(
CHANNELS == 1,
"Currently only one channel is implemented here.");
323 participant_frames[participant_index].resize(0, data_len_source);
324 char *particip_data = participant_frames[participant_index].get_data(0);
326 memset(particip_data, 0, data_len_source - ret);
327
329 auto dst = mixed.begin();
332 ++dst;
333 ++src;
334 }
335 participant_index++;
336 }
337
338
339 for (auto & pb : participant_frames) {
340 auto mix = mixed.begin();
344 ++mix;
345 ++part;
346 }
347 }
348
349
350 participant_index = 0;
352 audio_frame2 *uncompressed = &participant_frames[participant_index];
354 audio_tx_send(p.second.m_tx_session, p.second.m_network_device, &compressed);
355 uncompressed = nullptr;
356 }
357
358 participant_index++;
359 }
360 plk.unlock();
361 }
362}
int audio_buffer_read(struct audio_buffer *buf, char *out, int max_len)
audio_frame2 audio_codec_compress(struct audio_codec_state *s, const audio_frame2 *frame)
#define LOG_LEVEL_WARNING
less severe errors
#define PARTICIPANT_TIMEOUT_S
#define SAMPLES_PER_FRAME
int16_t sample_type_source
map< sockaddr_storage, am_participant, sockaddr_storage_less > participants
void set_thread_name(const char *name)
void audio_tx_send(struct tx *tx, struct rtp *rtp_session, const audio_frame2 *buffer)