{input,mixer}/alsa: move code to lib/alsa/NonBlock.cxx

This commit is contained in:
Max Kellermann
2017-02-08 19:35:27 +01:00
parent 67a958a326
commit 9e503b21c1
5 changed files with 121 additions and 26 deletions

View File

@@ -26,6 +26,7 @@
#include "config.h"
#include "AlsaInputPlugin.hxx"
#include "lib/alsa/NonBlock.hxx"
#include "../InputPlugin.hxx"
#include "../AsyncInputStream.hxx"
#include "event/Call.hxx"
@@ -177,20 +178,7 @@ AlsaInputStream::PrepareSockets()
return std::chrono::steady_clock::duration(-1);
}
int count = snd_pcm_poll_descriptors_count(capture_handle);
if (count <= 0) {
ClearSocketList();
return std::chrono::steady_clock::duration(-1);
}
struct pollfd *pfds = pfd_buffer.Get(count);
count = snd_pcm_poll_descriptors(capture_handle, pfds, count);
if (count < 0)
count = 0;
ReplaceSocketList(pfds, count);
return std::chrono::steady_clock::duration(-1);
return PrepareAlsaPcmSockets(*this, capture_handle, pfd_buffer);
}
void