Sfoglia il codice sorgente

Fix AudioOutputUSB handling of null data

teensy4-core
PaulStoffregen 7 anni fa
parent
commit
bf8b9137df
1 ha cambiato i file con 19 aggiunte e 8 eliminazioni
  1. +19
    -8
      teensy3/usb_audio.cpp

+ 19
- 8
teensy3/usb_audio.cpp Vedi File

@@ -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) {

Loading…
Annulla
Salva