lib/alsa/meson.build: require libasound 1.2 or later
This allows us to drop the 1.1.4 snd_pcm_drain() bug workaround (added
by commit f85d4d28d1
).
This commit is contained in:
parent
3bef4f839a
commit
9c8f4aaf99
|
@ -3,7 +3,7 @@ if not is_linux
|
|||
subdir_done()
|
||||
endif
|
||||
|
||||
libasound_dep = dependency('alsa', version: '>= 1.1', required: get_option('alsa'))
|
||||
libasound_dep = dependency('alsa', version: '>= 1.2', required: get_option('alsa'))
|
||||
if not libasound_dep.found()
|
||||
alsa_dep = dependency('', required: false)
|
||||
subdir_done()
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "lib/alsa/HwSetup.hxx"
|
||||
#include "lib/alsa/NonBlock.hxx"
|
||||
#include "lib/alsa/PeriodBuffer.hxx"
|
||||
#include "lib/alsa/Version.hxx"
|
||||
#include "lib/fmt/RuntimeError.hxx"
|
||||
#include "lib/fmt/ToBuffer.hxx"
|
||||
#include "../OutputAPI.hxx"
|
||||
|
@ -175,17 +174,6 @@ class AlsaOutput final
|
|||
bool need_thesycon_dsd_workaround = thesycon_dsd_workaround;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Is this a buggy alsa-lib version, which needs a workaround
|
||||
* for the snd_pcm_drain() bug always returning -EAGAIN? See
|
||||
* alsa-lib commits fdc898d41135 and e4377b16454f for details.
|
||||
* This bug was fixed in alsa-lib version 1.1.4.
|
||||
*
|
||||
* The workaround is to re-enable blocking mode for the
|
||||
* snd_pcm_drain() call.
|
||||
*/
|
||||
bool work_around_drain_bug;
|
||||
|
||||
/**
|
||||
* After Open() or Cancel(), has this output been activated by
|
||||
* a Play() command?
|
||||
|
@ -657,19 +645,6 @@ AlsaOutput::SetupOrDop(AudioFormat &audio_format, PcmExport::Params ¶ms
|
|||
#endif
|
||||
}
|
||||
|
||||
static constexpr bool
|
||||
MaybeDmix(snd_pcm_type_t type)
|
||||
{
|
||||
return type == SND_PCM_TYPE_DMIX || type == SND_PCM_TYPE_PLUG;
|
||||
}
|
||||
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
MaybeDmix(snd_pcm_t *pcm) noexcept
|
||||
{
|
||||
return MaybeDmix(snd_pcm_type(pcm));
|
||||
}
|
||||
|
||||
static const Alsa::AllowedFormat &
|
||||
BestMatch(const std::forward_list<Alsa::AllowedFormat> &haystack,
|
||||
const AudioFormat &needle)
|
||||
|
@ -842,9 +817,6 @@ AlsaOutput::Open(AudioFormat &audio_format)
|
|||
GetDevice()));
|
||||
}
|
||||
|
||||
work_around_drain_bug = MaybeDmix(pcm) &&
|
||||
GetRuntimeAlsaVersion() < MakeAlsaVersion(1, 1, 4);
|
||||
|
||||
snd_pcm_nonblock(pcm, 1);
|
||||
|
||||
#ifdef ENABLE_DSD
|
||||
|
@ -1058,14 +1030,7 @@ AlsaOutput::DrainInternal()
|
|||
|
||||
/* .. and finally drain the ALSA hardware buffer */
|
||||
|
||||
int result;
|
||||
if (work_around_drain_bug) {
|
||||
snd_pcm_nonblock(pcm, 0);
|
||||
result = snd_pcm_drain(pcm);
|
||||
snd_pcm_nonblock(pcm, 1);
|
||||
} else
|
||||
result = snd_pcm_drain(pcm);
|
||||
|
||||
const int result = snd_pcm_drain(pcm);
|
||||
if (result == 0)
|
||||
return true;
|
||||
else if (result == -EAGAIN)
|
||||
|
|
Loading…
Reference in New Issue