Kaynağa Gözat

Fix AudioOutputUSB handling of null data

main
PaulStoffregen 7 yıl önce
ebeveyn
işleme
bf8b9137df
1 değiştirilmiş dosya ile 19 ekleme ve 8 silme
  1. +19
    -8
      teensy3/usb_audio.cpp

+ 19
- 8
teensy3/usb_audio.cpp Dosyayı Görüntüle

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

Yükleniyor…
İptal
Kaydet