Add timestamp for PulseAudioDevice log entries.

pull/239/head
Mooneer Salem 2022-06-21 21:56:46 -07:00
parent 02f6aef602
commit 87faa0035e
1 changed files with 7 additions and 3 deletions

View File

@ -97,9 +97,11 @@ void PulseAudioDevice::start()
PA_STREAM_ADJUST_LATENCY);
int result = 0;
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
if (direction_ == IAudioEngine::AUDIO_ENGINE_OUT)
{
fprintf(stderr, "PulseAudioDevice: connecting to playback device %s\n", (const char*)devName_.ToUTF8());
fprintf(stderr, "PulseAudioDevice[%d.%d]: connecting to playback device %s\n", ts.tv_sec, ts.tv_nsec, (const char*)devName_.ToUTF8());
pa_stream_set_write_callback(stream_, &PulseAudioDevice::StreamWriteCallback_, this);
result = pa_stream_connect_playback(
@ -108,7 +110,7 @@ void PulseAudioDevice::start()
}
else
{
fprintf(stderr, "PulseAudioDevice: connecting to record device %s\n", (const char*)devName_.ToUTF8());
fprintf(stderr, "PulseAudioDevice[%d.%d]: connecting to record device %s\n", ts.tv_sec, ts.tv_nsec, (const char*)devName_.ToUTF8());
pa_stream_set_read_callback(stream_, &PulseAudioDevice::StreamReadCallback_, this);
result = pa_stream_connect_record(
@ -312,7 +314,9 @@ void PulseAudioDevice::StreamMovedCallback_(pa_stream *p, void *userdata)
auto newDevName = pa_stream_get_device_name(p);
PulseAudioDevice* thisObj = static_cast<PulseAudioDevice*>(userdata);
fprintf(stderr, "PulseAudioDevice: stream named %s has been moved to %s\n", (const char*)thisObj->devName_.ToUTF8(), newDevName);
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
fprintf(stderr, "PulseAudioDevice[%d.%d]: stream named %s has been moved to %s\n", ts.tv_sec, ts.tv_nsec, (const char*)thisObj->devName_.ToUTF8(), newDevName);
thisObj->devName_ = newDevName;