Ticket #8267: mythtv-alsa.patch

File mythtv-alsa.patch, 2.5 KB (added by tarek-spam@…, 10 years ago)

patch

  • libs/libmyth/audiooutputalsa.cpp

    diff --git a/libs/libmyth/audiooutputalsa.cpp b/libs/libmyth/audiooutputalsa.cpp
    index 8a12ceb..36fcf8b 100644
    a b int AudioOutputALSA::SetParameters(snd_pcm_t *handle, 
    421421        return err;
    422422    }
    423423
    424     if ((err = snd_pcm_hw_params_get_buffer_size(params, &buffer_size)) < 0)
    425     {
    426         Error(QString("Unable to get buffer size for playback: %1")
    427               .arg(snd_strerror(err)));
    428         return err;
    429     } else {
    430         VERBOSE(VB_AUDIO, QString("get_buffer_size returned %1").arg(buffer_size));
    431     }
    432     soundcard_buffer_size = buffer_size * audio_bytes_per_sample;
    433 
    434424    /* set the period time */
    435425    if ((err = snd_pcm_hw_params_set_period_time_near(
    436426                    handle, params, &period_time, &dir)) < 0)
    int AudioOutputALSA::SetParameters(snd_pcm_t *handle, 
    442432        VERBOSE(VB_AUDIO, QString("set_period_time_near returned %1").arg(period_time));
    443433    }
    444434
    445     if ((err = snd_pcm_hw_params_get_period_size(params, &period_size,
    446                                                 &dir)) < 0) {
    447         Error(QString("Unable to get period size for playback: %1")
     435    /* write the parameters to device */
     436    if ((err = snd_pcm_hw_params(handle, params)) < 0) {
     437        Error(QString("Unable to set hw params for playback: %1")
     438              .arg(snd_strerror(err)));
     439        return err;
     440    }
     441
     442    if ((err = snd_pcm_hw_params_get_buffer_size(params, &buffer_size)) < 0)
     443    {
     444        Error(QString("Unable to get buffer size for playback: %1")
    448445              .arg(snd_strerror(err)));
    449446        return err;
    450447    } else {
    451         VERBOSE(VB_AUDIO, QString("get_period_size returned %1").arg(period_size));
     448        VERBOSE(VB_AUDIO, QString("get_period_size returned %1").arg(buffer_size));
    452449    }
    453450
    454     /* write the parameters to device */
    455     if ((err = snd_pcm_hw_params(handle, params)) < 0) {
    456         Error(QString("Unable to set hw params for playback: %1")
     451    soundcard_buffer_size = buffer_size * audio_bytes_per_sample;
     452    if ((err = snd_pcm_hw_params_get_period_size(params, &period_size,
     453                                                &dir)) < 0) {
     454        Error(QString("Unable to get period size for playback: %1")
    457455              .arg(snd_strerror(err)));
    458456        return err;
     457    } else {
     458        VERBOSE(VB_AUDIO, QString("get_period_size returned %1").arg(period_size));
    459459    }
    460460   
    461461    /* get the current swparams */