Ticket #8500: accurate_audiots.patch

File accurate_audiots.patch, 21.9 KB (added by Mark Spieth, 14 years ago)
  • mythtv/libs/libmyth/audiooutput.h

    commit 0653c6ed8a80d31f3ded6d4bc5dd8267279f6281
    Author: Mark Spieth <mspieth@digivation.com.au>
    Date:   Tue Apr 27 07:51:51 2010 +1000
    
        smoother vsync with predictive frame skipping
    
    diff --git a/mythtv/libs/libmyth/audiooutput.h b/mythtv/libs/libmyth/audiooutput.h
    index f3ec2b0..e522304 100644
    a b  
    33
    44#include <QString>
    55
     6#include "compat.h"
    67#include "audiosettings.h"
    78#include "mythcorecontext.h"
    89#include "volumebase.h"
    class MPUBLIC AudioOutput : public VolumeBase, public OutputListeners 
    4243
    4344    virtual void Reset(void) = 0;
    4445
    45     virtual bool AddSamples(void *buffer, int samples, long long timecode) = 0;
     46    virtual bool AddSamples(void *buffer, int samples, int64_t timecode) = 0;
    4647
    47     virtual void SetTimecode(long long timecode) = 0;
     48    virtual void SetTimecode(int64_t timecode) = 0;
    4849    virtual bool IsPaused(void) const = 0;
    4950    virtual void Pause(bool paused) = 0;
    5051    virtual void PauseUntilBuffered(void) = 0;
    class MPUBLIC AudioOutput : public VolumeBase, public OutputListeners 
    5253    // Wait for all data to finish playing
    5354    virtual void Drain(void) = 0;
    5455
    55     virtual int GetAudiotime(void) = 0;
     56    virtual int64_t GetAudiotime(void) = 0;
    5657
    5758    /// report amount of audio buffered in milliseconds.
    58     virtual int GetAudioBufferedTime(void) { return 0; }
     59    virtual int64_t GetAudioBufferedTime(void) { return 0; }
    5960
    6061    virtual void SetSourceBitrate(int ) { }
    6162
  • mythtv/libs/libmyth/audiooutputbase.cpp

    diff --git a/mythtv/libs/libmyth/audiooutputbase.cpp b/mythtv/libs/libmyth/audiooutputbase.cpp
    index 9213adf..1cae7bc 100644
    a b AudioOutputBase::AudioOutputBase(const AudioSettings &settings) : 
    5656    passthru(false),            enc(false),
    5757    reenc(false),
    5858    stretchfactor(1.0f),
     59    eff_stretchfactor(100000),
    5960
    6061    source(settings.source),    killaudio(false),
    6162
    void AudioOutputBase::SetStretchFactorLocked(float lstretchfactor) 
    179180        return;
    180181
    181182    stretchfactor = lstretchfactor;
     183    eff_stretchfactor = (int)(100000.0f * lstretchfactor + 0.5);
    182184    if (pSoundStretch)
    183185    {
    184186        VBGENERAL(QString("Changing time stretch to %1").arg(stretchfactor));
    void AudioOutputBase::Reset() 
    596598 * Used by mythmusic for seeking since it doesn't provide timecodes to
    597599 * AddSamples()
    598600 */
    599 void AudioOutputBase::SetTimecode(long long timecode)
     601void AudioOutputBase::SetTimecode(int64_t timecode)
    600602{
    601603    audbuf_timecode = audiotime = timecode;
    602     frames_buffered = (long long)((timecode * source_samplerate) / 1000);
     604    frames_buffered = (int64_t)((timecode * source_samplerate) / 1000);
    603605}
    604606
    605607/**
    int AudioOutputBase::audioready() 
    654656/**
    655657 * Calculate the timecode of the samples that are about to become audible
    656658 */
    657 int AudioOutputBase::GetAudiotime(void)
     659int64_t AudioOutputBase::GetAudiotime(void)
    658660{
    659661    if (audbuf_timecode == 0)
    660662        return 0;
    661663
    662     int soundcard_buffer = 0;
    663664    int obpf = output_bytes_per_frame;
    664     int totalbuffer;
    665     long long oldaudiotime;
     665    int64_t oldaudiotime;
    666666
    667667    /* We want to calculate 'audiotime', which is the timestamp of the audio
    668        which is leaving the sound card at this instant.
     668       Which is leaving the sound card at this instant.
    669669
    670670       We use these variables:
    671671
    int AudioOutputBase::GetAudiotime(void) 
    677677       'totalbuffer' is the total # of bytes in our audio buffer, and the
    678678       sound card's buffer. */
    679679
    680     soundcard_buffer = GetBufferedOnSoundcard(); // bytes
    681680
    682681    QMutexLocker lockav(&avsync_lock);
    683682
     683    int64_t soundcard_buffer = GetBufferedOnSoundcard(); // bytes
     684    int64_t main_buffer = audioready();
     685
    684686    /* audioready tells us how many bytes are in audiobuffer
    685687       scaled appropriately if output format != internal format */
    686     totalbuffer = audioready() + soundcard_buffer;
    687 
    688     if (needs_upmix && upmixer)
    689         totalbuffer += upmixer->frameLatency() * obpf;
    690 
    691     if (pSoundStretch)
    692     {
    693         totalbuffer += pSoundStretch->numUnprocessedSamples() * obpf /
    694                        stretchfactor;
    695         totalbuffer += pSoundStretch->numSamples() * obpf;
    696     }
    697 
    698     if (encoder)
    699         totalbuffer += encoder->Buffered();
    700688
    701689    oldaudiotime = audiotime;
    702690
    703     audiotime = audbuf_timecode - (long long)(totalbuffer) * 100000 *
    704                                         stretchfactor / (obpf * effdsp);
     691    // timecode is the stretch adjusted version
     692    // of major post-stretched buffer contents
     693    // processing latencies are catered for in AddSamples/SetAudiotime to eliminate
     694    // race
     695    audiotime = audbuf_timecode - (( (main_buffer + soundcard_buffer) * eff_stretchfactor ) / (effdsp * obpf));
    705696
    706697    /* audiotime should never go backwards, but we might get a negative
    707698       value if GetBufferedOnSoundcard() isn't updated by the driver very
    int AudioOutputBase::GetAudiotime(void) 
    709700    if (audiotime < oldaudiotime)
    710701        audiotime = oldaudiotime;
    711702
    712     VBAUDIOTS(QString("GetAudiotime audt=%3 atc=%4 tb=%5 sb=%6 "
    713                       "sr=%7 obpf=%8 sf=%9")
     703    VBAUDIOTS(QString("GetAudiotime audt=%1 atc=%2 mb=%3 sb=%4 tb=%5 "
     704                      "sr=%6 obpf=%7 bpf=%8 sf=%9 %10 %11")
    714705              .arg(audiotime).arg(audbuf_timecode)
    715               .arg(totalbuffer).arg(soundcard_buffer)
    716               .arg(samplerate).arg(obpf).arg(stretchfactor));
     706              .arg(main_buffer)
     707              .arg(soundcard_buffer)
     708              .arg(main_buffer+soundcard_buffer)
     709              .arg(samplerate).arg(obpf).arg(bytes_per_frame).arg(stretchfactor)
     710              .arg((main_buffer + soundcard_buffer) * eff_stretchfactor)
     711              .arg(( (main_buffer + soundcard_buffer) * eff_stretchfactor ) / (effdsp * obpf))
     712              );
     713
     714    return audiotime;
     715}
     716
     717/**
     718 * Set the timecode of the top of the ringbuffer
     719 * Exclude all other processing elements as they dont vary
     720 * between AddSamples calls
     721 */
     722void AudioOutputBase::SetAudiotime(int frames, int64_t timecode)
     723{
     724    int64_t processframes_stretched = 0;
     725    int64_t processframes_unstretched = 0;
     726
     727    if (needs_upmix && upmixer)
     728        processframes_unstretched -= upmixer->frameLatency();
     729
     730    if (pSoundStretch)
     731    {
     732        processframes_unstretched -= pSoundStretch->numUnprocessedSamples();
     733        processframes_stretched -= pSoundStretch->numSamples();
     734    }
    717735
    718     return (int)audiotime;
     736    if (encoder)
     737        // the input buffered data is still in audio_bytes_per_sample format
     738        processframes_stretched -= encoder->Buffered() / output_bytes_per_frame;
     739
     740    audbuf_timecode = timecode +
     741                (((frames + processframes_unstretched) * 100000) +
     742                  (processframes_stretched * eff_stretchfactor )) / effdsp;
     743
     744    VBAUDIOTS(QString("SetAudiotime atc=%1 tc=%2 f=%3 pfu=%4 pfs=%5")
     745              .arg(audbuf_timecode)
     746              .arg(timecode)
     747              .arg(frames)
     748              .arg(processframes_unstretched)
     749              .arg(processframes_stretched));
     750#ifdef AUDIOTSTESTING
     751    GetAudiotime();
     752#endif
    719753}
    720754
    721755/**
    int AudioOutputBase::GetAudiotime(void) 
    723757 * audible and the samples most recently added to the audiobuffer, i.e. the
    724758 * time in ms representing the sum total of buffered samples
    725759 */
    726 int AudioOutputBase::GetAudioBufferedTime(void)
     760int64_t AudioOutputBase::GetAudioBufferedTime(void)
    727761{
    728762    int ret = audbuf_timecode - GetAudiotime();
    729763    // Pulse can give us values that make this -ve
    int AudioOutputBase::CopyWithUpmix(char *buffer, int frames, int &org_waud) 
    869903 *
    870904 * Returns false if there's not enough space right now
    871905 */
    872 bool AudioOutputBase::AddSamples(void *buffer, int frames, long long timecode)
     906bool AudioOutputBase::AddSamples(void *buffer, int in_frames, int64_t timecode)
    873907{
    874908    int org_waud = waud,               afree = audiofree();
    875     int bpf      = bytes_per_frame,    len   = frames * source_bytes_per_frame;
     909    int frames = in_frames;
     910    int bpf      = bytes_per_frame,    len   = in_frames * source_bytes_per_frame;
    876911    int used     = kAudioRingBufferSize - afree;
    877912    bool music   = false;
     913    int bdiff;
    878914
    879915    VBAUDIOTS(QString("AddSamples frames=%1, bytes=%2, used=%3, free=%4, "
    880916                      "timecode=%5 needsupmix=%6")
    bool AudioOutputBase::AddSamples(void *buffer, int frames, long long timecode) 
    896932    if (timecode < 0)
    897933    {
    898934        // Send original samples to mythmusic visualisation
    899         timecode = (long long)(frames_buffered) * 1000 / source_samplerate;
     935        timecode = (int64_t)(frames_buffered) * 1000 / source_samplerate;
    900936        frames_buffered += frames;
    901937        dispatchVisual((uchar *)buffer, len, timecode, source_channels,
    902938                       output_settings->FormatToBits(format));
    bool AudioOutputBase::AddSamples(void *buffer, int frames, long long timecode) 
    949985                    .arg(src_strerror(error)));
    950986
    951987        buffer = src_out;
    952         frames = src_data.output_frames_gen;
     988        in_frames = frames = src_data.output_frames_gen;
    953989    }
    954990    else if (processing)
    955991        buffer = src_in;
    bool AudioOutputBase::AddSamples(void *buffer, int frames, long long timecode) 
    957993    /* we want the timecode of the last sample added but we are given the
    958994       timecode of the first - add the time in ms that the frames added
    959995       represent */
    960     audbuf_timecode = timecode + ((long long)(frames) * 100000 / effdsp);
     996    //audbuf_timecode = timecode + ((int64_t)((frames) * 100000) / effdsp);
    961997
    962998    // Copy samples into audiobuffer, with upmix if necessary
    963999    if ((len = CopyWithUpmix((char *)buffer, frames, org_waud)) <= 0)
    964         return true;
     1000    {
     1001        //return true;
     1002        goto done;
     1003    }
    9651004
    9661005    frames = len / bpf;
    9671006
    968     int bdiff = kAudioRingBufferSize - waud;
     1007    bdiff = kAudioRingBufferSize - waud;
    9691008
    9701009    if (pSoundStretch)
    9711010    {
    bool AudioOutputBase::AddSamples(void *buffer, int frames, long long timecode) 
    10431082
    10441083    waud = org_waud;
    10451084
     1085done:
     1086    SetAudiotime(in_frames, timecode);
     1087
    10461088    return true;
    10471089}
    10481090
    void AudioOutputBase::OutputAudioLoop(void) 
    10901132    uchar *fragment_buf = new uchar[fragment_size + 16];
    10911133    uchar *fragment     = (uchar *)AOALIGN(fragment_buf[0]);
    10921134
     1135    // to reduce startup latency, write silence in 8ms chunks
     1136    int zero_fragment_size = (int)(0.008*samplerate/channels);
     1137    zero_fragment_size *= bytes_per_frame;   // make sure its a multiple of bytes_per_frame
     1138    if (zero_fragment_size > fragment_size)
     1139        zero_fragment_size = fragment_size;
     1140
    10931141    bzero(zeros, fragment_size);
    10941142
    10951143    while (!killaudio)
    void AudioOutputBase::OutputAudioLoop(void) 
    11381186            continue;
    11391187        }
    11401188
     1189#ifdef AUDIOTSTESTING
     1190        VBAUDIOTS("WriteAudio Start");
     1191#endif
    11411192        Status();
    11421193
    1143         if (GetAudioData(fragment, fragment_size, true))
     1194        // delay setting raud until after phys buffer is filled
     1195        // so GetAudiotime will be accurate without locking
     1196        int next_raud = raud;
     1197        if (GetAudioData(fragment, fragment_size, true, &next_raud))
     1198        {
    11441199            WriteAudio(fragment, fragment_size);
     1200            raud = next_raud;
     1201        }
     1202#ifdef AUDIOTSTESTING
     1203        GetAudiotime();
     1204        VBAUDIOTS("WriteAudio Done");
     1205#endif
     1206
    11451207    }
    11461208
    11471209    delete[] zeros;
    void AudioOutputBase::OutputAudioLoop(void) 
    11581220 * nothing. Otherwise, we'll copy less than 'size' bytes if that's all that's
    11591221 * available. Returns the number of bytes copied.
    11601222 */
    1161 int AudioOutputBase::GetAudioData(uchar *buffer, int size, bool full_buffer)
     1223int AudioOutputBase::GetAudioData(uchar *buffer, int size, bool full_buffer, int *local_raud)
    11621224{
    11631225
     1226#define LRPOS audiobuffer + *local_raud
    11641227    // re-check audioready() in case things changed.
    11651228    // for example, ClearAfterSeek() might have run
    11661229    int avail_size   = audioready();
    11671230    int frag_size    = size;
    11681231    int written_size = size;
    11691232
     1233    if (local_raud == NULL)
     1234        local_raud = &raud;
     1235
    11701236    if (!full_buffer && (size > avail_size))
    11711237    {
    11721238        // when full_buffer is false, return any available data
    int AudioOutputBase::GetAudioData(uchar *buffer, int size, bool full_buffer) 
    11921258    {
    11931259        if (fromFloats)
    11941260            off = AudioOutputUtil::fromFloat(output_format, buffer,
    1195                                              RPOS, bdiff);
     1261                                             LRPOS, bdiff);
    11961262        else
    11971263        {
    1198             memcpy(buffer, RPOS, bdiff);
     1264            memcpy(buffer, LRPOS, bdiff);
    11991265            off = bdiff;
    12001266        }
    12011267
    12021268        frag_size -= bdiff;
    1203         raud = 0;
     1269        *local_raud = 0;
    12041270    }
    12051271    if (frag_size > 0)
    12061272    {
    12071273        if (fromFloats)
    12081274            AudioOutputUtil::fromFloat(output_format, buffer + off,
    1209                                        RPOS, frag_size);
     1275                                       LRPOS, frag_size);
    12101276        else
    1211             memcpy(buffer + off, RPOS, frag_size);
     1277            memcpy(buffer + off, LRPOS, frag_size);
    12121278    }
    12131279
    1214     raud += frag_size;
     1280    *local_raud += frag_size;
    12151281
    12161282    // Mute individual channels through mono->stereo duplication
    12171283    MuteState mute_state = GetMuteState();
  • mythtv/libs/libmyth/audiooutputbase.h

    diff --git a/mythtv/libs/libmyth/audiooutputbase.h b/mythtv/libs/libmyth/audiooutputbase.h
    index 61ec79d..11a19ba 100644
    a b class AudioOutputBase : public AudioOutput, public QThread 
    5757    int GetSWVolume(void);
    5858
    5959    // timecode is in milliseconds.
    60     virtual bool AddSamples(void *buffer, int frames, long long timecode);
     60    virtual bool AddSamples(void *buffer, int frames, int64_t timecode);
    6161
    62     virtual void SetTimecode(long long timecode);
     62    virtual void SetTimecode(int64_t timecode);
    6363    virtual bool IsPaused(void) const { return actually_paused; }
    6464    virtual void Pause(bool paused);
    6565    void PauseUntilBuffered(void);
    class AudioOutputBase : public AudioOutput, public QThread 
    6767    // Wait for all data to finish playing
    6868    virtual void Drain(void);
    6969
    70     virtual int GetAudiotime(void);
    71     virtual int GetAudioBufferedTime(void);
     70    virtual int64_t GetAudiotime(void);
     71    virtual int64_t GetAudioBufferedTime(void);
    7272
    7373    // Send output events showing current progress
    7474    virtual void Status(void);
    class AudioOutputBase : public AudioOutput, public QThread 
    8383
    8484    static const uint kAudioSRCInputSize  = 16384<<1;
    8585    static const uint kAudioSRCOutputSize = 16384<<3;
    86     /// Audio Buffer Size -- should be divisible by 12,10,8,6,4,2..
    87     static const uint kAudioRingBufferSize   = 1536000;
     86    /// Audio Buffer Size -- should be divisible by 32,24,16,12,10,8,6,4,2..
     87    static const uint kAudioRingBufferSize   = 3072000;
    8888
    8989 protected:
    9090    // You need to implement the following functions
    class AudioOutputBase : public AudioOutput, public QThread 
    102102    virtual bool StartOutputThread(void);
    103103    virtual void StopOutputThread(void);
    104104
    105     int GetAudioData(uchar *buffer, int buf_size, bool fill_buffer);
     105    int GetAudioData(uchar *buffer, int buf_size, bool fill_buffer, int *local_raud = NULL);
    106106
    107107    void OutputAudioLoop(void);
    108108
    class AudioOutputBase : public AudioOutput, public QThread 
    138138    bool passthru, enc, reenc;
    139139
    140140    float stretchfactor;
     141    int  eff_stretchfactor;     // scaled to 100000 as effdsp is
    141142    AudioOutputSource source;
    142143
    143144    bool killaudio;
    class AudioOutputBase : public AudioOutput, public QThread 
    153154
    154155 private:
    155156    int CopyWithUpmix(char *buffer, int frames, int &org_waud);
     157    void SetAudiotime(int frames, int64_t timecode);
    156158    AudioOutputSettings *output_settings;
    157159    bool need_resampler;
    158160    SRC_STATE *src_ctx;
    class AudioOutputBase : public AudioOutput, public QThread 
    175177
    176178    bool processing;
    177179
    178     long long frames_buffered;
     180    int64_t frames_buffered;
    179181
    180182    bool audio_thread_exists;
    181183
    class AudioOutputBase : public AudioOutput, public QThread 
    188190    QMutex avsync_lock;
    189191
    190192    // timecode of audio leaving the soundcard (same units as timecodes)
    191     long long audiotime;
     193    int64_t audiotime;
    192194
    193195    /* Audio circular buffer */
    194196    int raud, waud;     /* read and write positions */
    195197    // timecode of audio most recently placed into buffer
    196     long long audbuf_timecode;
     198    int64_t audbuf_timecode;
    197199
    198200    QMutex killAudioLock;
    199201
  • mythtv/libs/libmythfreesurround/freesurround.cpp

    diff --git a/mythtv/libs/libmythfreesurround/freesurround.cpp b/mythtv/libs/libmythfreesurround/freesurround.cpp
    index 5e8b1f5..aef65a3 100644
    a b Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 
    2929using namespace std;
    3030
    3131#include "compat.h"
     32#include "mythverbose.h"
    3233#include "freesurround.h"
    3334#include "el_processor.h"
    3435
    3536#include <QString>
    3637#include <QDateTime>
    3738
    38 #if 0
    39 #define VERBOSE(args...) \
    40     do { \
    41         QDateTime dtmp = QDateTime::currentDateTime(); \
    42         QString dtime = dtmp.toString("yyyy-MM-dd hh:mm:ss.zzz"); \
    43         std::cout << dtime.toLocal8Bit().constData() << " " \
    44             << QString(args).toLocal8Bit().constData() << std::endl; \
    45     } while (0)
    46 #else
    47 #define VERBOSE(args...)
    48 #endif
    49 #if 0
    50 #define VERBOSE1(args...) \
    51     do { \
    52         QDateTime dtmp = QDateTime::currentDateTime(); \
    53         QString dtime = dtmp.toString("yyyy-MM-dd hh:mm:ss.zzz"); \
    54         std::cout << dtime.toLocal8Bit().constData() << " " \
    55             << QString(args).toLocal8Bit().constData() << std::endl; \
    56     } while (0)
    57 #else
    58 #define VERBOSE1(args...)
    59 #endif
    60 
    6139// our default internal block size, in floats
    6240static const unsigned default_block_size = 8192;
    6341// Gain of center and lfe channels in passive mode (sqrt 0.5)
    FreeSurround::FreeSurround(uint srate, bool moviemode, SurroundMode smode) : 
    161139    processed_size(0),
    162140    surround_mode(smode)
    163141{
    164     VERBOSE(QString("FreeSurround::FreeSurround rate %1 moviemode %2")
     142    VERBOSE(VB_AUDIO+VB_EXTRA, QString("FreeSurround::FreeSurround rate %1 moviemode %2")
    165143            .arg(srate).arg(moviemode));
    166144
    167145    if (moviemode)
    FreeSurround::FreeSurround(uint srate, bool moviemode, SurroundMode smode) : 
    193171    channel_select++;
    194172    if (channel_select>=6)
    195173        channel_select = 0;
    196     VERBOSE(QString("FreeSurround::FreeSurround channel_select %1")
     174    VERBOSE(VB_AUDIO+VB_EXTRA, QString("FreeSurround::FreeSurround channel_select %1")
    197175            .arg(channel_select));
    198176#endif
    199     VERBOSE(QString("FreeSurround::FreeSurround done"));
     177    VERBOSE(VB_AUDIO+VB_EXTRA, QString("FreeSurround::FreeSurround done"));
    200178}
    201179
    202180void FreeSurround::SetParams()
    FreeSurround::fsurround_params::fsurround_params(int32_t center_width, 
    224202
    225203FreeSurround::~FreeSurround()
    226204{
    227     VERBOSE(QString("FreeSurround::~FreeSurround"));
     205    VERBOSE(VB_AUDIO+VB_EXTRA, QString("FreeSurround::~FreeSurround"));
    228206    close();
    229207    if (bufs)
    230208    {
    231209        bp.release((void*)1);
    232210        bufs = NULL;
    233211    }
    234     VERBOSE(QString("FreeSurround::~FreeSurround done"));
     212    VERBOSE(VB_AUDIO+VB_EXTRA, QString("FreeSurround::~FreeSurround done"));
    235213}
    236214
    237215uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels)
    uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels) 
    289267                    break;
    290268            }
    291269            ic += numFrames;
    292             in_count = ic;
    293270            processed = process;
    294271            if (ic != bs)
     272            {
     273                // dont modify unless no processing is to be done
     274                // for audiotime consistency
     275                in_count = ic;
    295276                break;
    296             in_count = 0;
     277            }
     278            // process_block takes some time so dont update in and out count
     279            // before its finished so that Audiotime is correctly calculated
    297280            if (process)
    298281                process_block();
     282            in_count = 0;
    299283            out_count = bs;
    300284            processed_size = bs;
    301285            break;
    302286    }
    303287
    304     VERBOSE1(QString("FreeSurround::putFrames %1 %2 used %4 generated %5")
     288    VERBOSE(VB_AUDIO+VB_TIMESTAMP+VB_EXTRA, QString("FreeSurround::putFrames %1 #ch %2 used %4 generated %5")
    305289            .arg(numFrames).arg(numChannels).arg(i).arg(out_count));
    306290
    307291    return i;
    uint FreeSurround::receiveFrames(void *buffer, uint maxFrames) 
    318302    switch (surround_mode)
    319303    {
    320304        case SurroundModePassive:
    321             for (uint i = 0; i < maxFrames; i++)
     305            for (i = 0; i < maxFrames; i++)
    322306            {
    323307                *output++ = bufs->l[outindex];
    324308                *output++ = bufs->r[outindex];
    uint FreeSurround::receiveFrames(void *buffer, uint maxFrames) 
    341325                float *ls  = &outputs[3][outindex];
    342326                float *rs  = &outputs[4][outindex];
    343327                float *lfe = &outputs[5][outindex];
    344                 for (uint i = 0; i < maxFrames; i++)
     328                for (i = 0; i < maxFrames; i++)
    345329                {
    346330                    *output++ = *l++;
    347331                    *output++ = *r++;
    uint FreeSurround::receiveFrames(void *buffer, uint maxFrames) 
    361345                float *ls  = &bufs->ls[outindex];
    362346                float *rs  = &bufs->rs[outindex];
    363347                float *lfe = &bufs->lfe[outindex];
    364                 for (uint i = 0; i < maxFrames; i++)
     348                for (i = 0; i < maxFrames; i++)
    365349                {
    366350                    *output++ = *l++;
    367351                    *output++ = *r++;
    uint FreeSurround::receiveFrames(void *buffer, uint maxFrames) 
    376360            break;
    377361    }
    378362    out_count = oc;
    379     VERBOSE1(QString("FreeSurround::receiveFrames %1").arg(maxFrames));
     363    VERBOSE(VB_AUDIO+VB_TIMESTAMP+VB_EXTRA, QString("FreeSurround::receiveFrames %1").arg(maxFrames));
    380364    return maxFrames;
    381365}
    382366