|
|
@ -18,7 +18,9 @@
|
|
|
|
Boston, MA 02110-1301, USA.
|
|
|
|
Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
// #define DEBUG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "akode_debug.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <alsa/asoundlib.h>
|
|
|
|
#include <alsa/asoundlib.h>
|
|
|
|
#include <alsa/pcm.h>
|
|
|
|
#include <alsa/pcm.h>
|
|
|
@ -308,4 +310,33 @@ void ALSASink::resume()
|
|
|
|
snd_pcm_pause(m_data->pcm_playback, 0);
|
|
|
|
snd_pcm_pause(m_data->pcm_playback, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ALSASink::drop()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (m_data->error)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AKODE_WARN("cannot drop frames because error with sink");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int err = snd_pcm_drop(m_data->pcm_playback);
|
|
|
|
|
|
|
|
if (err < 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AKODE_WARN("unable to drop frames: " << snd_strerror(err));
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delete[] m_data->buffer;
|
|
|
|
|
|
|
|
m_data->buffer = new char[m_data->fragmentSize];
|
|
|
|
|
|
|
|
m_data->filled = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
err = snd_pcm_prepare(m_data->pcm_playback);
|
|
|
|
|
|
|
|
if (err < 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// No need to set error since calling writeFrame() or
|
|
|
|
|
|
|
|
// setAudioConfiguration() again.
|
|
|
|
|
|
|
|
AKODE_WARN("unable to prepare sink: " << snd_strerror(err));
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
} // namespace
|
|
|
|