2011-05-25 08:46:10     bf5xx-i2s-pcm.c bug in bf5xx_pcm_pointer?

Document created by Aaronwu Employee on Aug 27, 2013
Version 1Show Document
  • View in full screen mode

2011-05-25 08:46:10     bf5xx-i2s-pcm.c bug in bf5xx_pcm_pointer?

Reggy Perrin (UNITED STATES)

Message: 100835   

 

Hi folks,

 

While trying to track down another issue, I enabled ALSA debugging  in the procfs.  Once I did, I continually received these alerts:

 

ALSA sound/core/pcm_lib.c:319: BUG: pcmC0D0p:0, pos = 12304, buffer size = 12304, period size = 769

 

With some digging, I patched the file to stop the error as follows:

 

static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream)

{

    struct snd_pcm_runtime *runtime = substream->runtime;

    struct sport_device *sport = runtime->private_data;

    unsigned int diff;

    snd_pcm_uframes_t frames;

    if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {

        diff = sport_curr_offset_tx(sport);

        frames = bytes_to_frames(substream->runtime, diff);

    } else {

        diff = sport_curr_offset_rx(sport);

        frames = bytes_to_frames(substream->runtime, diff);

    }

    if ( frames == substream->runtime->buffer_size || frames < 0 ) {

        frames = 0;

 

    }

    return frames;

}

 

Is this a valid solution to the above problem?

 

Thanks, RP

Attachments

    Outcomes