Why is the ASRC buffer not filled when it's being used for copy to DAC?

I'm looking at the SPDIF Playback example as sort of a base for a future project. I've added a bit of instrumentation in ProcessBuffers to view the signals as they get passed between buffers

pSrc = (int32_t *)pASRC;
pDst = (int32_t *)pDAC;
for(i=0; i<AUDIO_BUFFER_SIZE>>2;i++)
{
    *pDst++ = *pSrc;

    save_array_float[(AUDIO_BUFFER_SIZE>>3)*(i%2) + i>>1] = (float)(*pSrc++)/16777216.0;
}

Things I changed (for clarification):

  • I changed the source and destination buffer typecasts to int32_t* from int8_t so that I didn't have to grab each sample a byte at a time. 
  • I changed the for loop to iterate over the size of AUDIO_BUFFER_SIZE>>2 to account for the change of buffer pointer size.
  • I included an array "save_array_float[AUDIO_BUFFER_SIZE]" to save all the samples from *pSrc, for a particular frame, to inspect during a debug break. I'm populating this array by splitting the channels and putting the second channels samples in the second half of the array.

What I've noticed is that the source buffer is only ever 75% filled. The second channels second half is all zeroed out. 

I played a 1kHz sine wave through the SPDIF from my PC and then hit suspend. When I plotted save_array_float I got

What I expected to get was two 64-samples-long frames of a sine wave. As you can see the second channel is only half there and they are not even in phase. 

I don't know how to explain this. Should I expect this?

Edit: I should also mention that this problem persists even when varying the size of AUDIO_BUFFER_SIZE

 



Edit1: Forgot to mention consistency when varying AUDIO_BUFFER_SIZE
[edited by: RudySilva at 5:22 AM (GMT 0) on 16 Aug 2019]