Explorar el Código

Fix AudioOutputUSB handling of null data

main
PaulStoffregen hace 7 años
padre
commit
bf8b9137df
Se han modificado 1 ficheros con 19 adiciones y 8 borrados
  1. +19
    -8
      teensy3/usb_audio.cpp

+ 19
- 8
teensy3/usb_audio.cpp Ver fichero

@@ -255,8 +255,11 @@ void AudioOutputUSB::update(void)
{
audio_block_t *left, *right;

left = receiveReadOnly(0); // input 0 = left channel
right = receiveReadOnly(1); // input 1 = right channel
// TODO: we shouldn't be writing to these......
//left = receiveReadOnly(0); // input 0 = left channel
//right = receiveReadOnly(1); // input 1 = right channel
left = receiveWritable(0); // input 0 = left channel
right = receiveWritable(1); // input 1 = right channel
if (usb_audio_transmit_setting == 0) {
if (left) release(left);
if (right) release(right);
@@ -268,12 +271,20 @@ void AudioOutputUSB::update(void)
return;
}
if (left == NULL) {
if (right == NULL) return;
right->ref_count++;
left = right;
} else if (right == NULL) {
left->ref_count++;
right = left;
left = allocate();
if (left == NULL) {
if (right) release(right);
return;
}
memset(left->data, 0, sizeof(left->data));
}
if (right == NULL) {
right = allocate();
if (right == NULL) {
release(left);
return;
}
memset(right->data, 0, sizeof(right->data));
}
__disable_irq();
if (left_1st == NULL) {

Cargando…
Cancelar
Guardar