瀏覽代碼

Fix AudioOutputUSB handling of null data

main
PaulStoffregen 7 年之前
父節點
當前提交
bf8b9137df
共有 1 個文件被更改,包括 19 次插入8 次删除
  1. +19
    -8
      teensy3/usb_audio.cpp

+ 19
- 8
teensy3/usb_audio.cpp 查看文件

@@ -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…
取消
儲存