From 579783f73845f7dafe1cd97ed109147282a7732f Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Mon, 28 Jul 2014 09:52:26 +0000 Subject: fixed freezing in the alsa plugin git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@4389 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Output/alsa/outputalsa.cpp | 8 ++------ src/plugins/Output/alsa/outputalsa.h | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'src/plugins/Output') diff --git a/src/plugins/Output/alsa/outputalsa.cpp b/src/plugins/Output/alsa/outputalsa.cpp index 8b5a04c5c..b0f6233f2 100644 --- a/src/plugins/Output/alsa/outputalsa.cpp +++ b/src/plugins/Output/alsa/outputalsa.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2012 by Ilya Kotov * + * Copyright (C) 2006-2014 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -18,9 +18,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include -//#include -//#include #include #include #include @@ -189,13 +186,12 @@ bool OutputALSA::initialize(quint32 freq, int chan, Qmmp::AudioFormat format) return false; } //setup needed values - m_bits_per_frame = snd_pcm_format_physical_width(alsa_format) * chan; m_chunk_size = period_size; m_can_pause = snd_pcm_hw_params_can_pause(hwparams) && use_pause; qDebug("OutputALSA: can pause: %d", m_can_pause); configure(freq, chan, format); //apply configuration //create alsa prebuffer; - m_prebuf_size = /*QMMP_BUFFER_SIZE + */m_bits_per_frame * m_chunk_size / 8; + m_prebuf_size = 2 * snd_pcm_frames_to_bytes(pcm_handle, m_chunk_size); //buffer for two periods m_prebuf = (uchar *)malloc(m_prebuf_size); m_inited = true; diff --git a/src/plugins/Output/alsa/outputalsa.h b/src/plugins/Output/alsa/outputalsa.h index c8e606f6c..1600e3b29 100644 --- a/src/plugins/Output/alsa/outputalsa.h +++ b/src/plugins/Output/alsa/outputalsa.h @@ -58,7 +58,6 @@ private: snd_pcm_t *pcm_handle; char *pcm_name; snd_pcm_uframes_t m_chunk_size; - size_t m_bits_per_frame; //prebuffer uchar *m_prebuf; qint64 m_prebuf_size; -- cgit v1.2.3-13-gbd6f