X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=alsa_output.cpp;h=d5ee35fd9ec77214b2b10b03e9b7859e56f2b9c9;hb=177725e4f259a75dcdbd4260ac57e5dd9c01fd57;hp=a3d17a2088ca0a49ad9ababfa118363150a07147;hpb=c58345b12770f5ac730d02d9cf50af78df526acd;p=nageru diff --git a/alsa_output.cpp b/alsa_output.cpp index a3d17a2..d5ee35f 100644 --- a/alsa_output.cpp +++ b/alsa_output.cpp @@ -17,7 +17,7 @@ void die_on_error(const char *func_name, int err) } // namespace ALSAOutput::ALSAOutput(int sample_rate, int num_channels) - : num_channels(num_channels) + : sample_rate(sample_rate), num_channels(num_channels) { die_on_error("snd_pcm_open()", snd_pcm_open(&pcm_handle, "default", SND_PCM_STREAM_PLAYBACK, 0)); @@ -79,7 +79,8 @@ try_again: if (ret == 0) { if (buffer.size() >= period_size * num_channels * 8) { // OK, almost 100 ms. Giving up. - fprintf(stderr, "warning: ALSA overrun, dropping some audio\n"); + fprintf(stderr, "warning: ALSA overrun, dropping some audio (%d ms)\n", + int(buffer.size() * 1000 / (num_channels * sample_rate))); buffer.clear(); } } else if (ret > 0) {