55 |
|
static int audio_channel_count_index = 0; |
56 |
|
|
57 |
|
// Global variables |
58 |
+ |
static bool is_dsp_audio = false; // Flag: is DSP audio |
59 |
|
static int audio_fd = -1; // fd of dsp or ESD |
60 |
|
static int mixer_fd = -1; // fd of mixer |
61 |
|
static sem_t audio_irq_done_sem; // Signal from interrupt to streaming thread: data block read |
96 |
|
} |
97 |
|
|
98 |
|
printf("Using %s audio output\n", dsp); |
99 |
+ |
is_dsp_audio = true; |
100 |
|
|
101 |
|
// Get supported sample formats |
102 |
|
if (audio_sample_sizes.empty()) { |
323 |
|
|
324 |
|
// Close dsp or ESD socket |
325 |
|
if (audio_fd >= 0) { |
326 |
+ |
if (is_dsp_audio) { |
327 |
+ |
// Stop the device immediately. Otherwise, close() sends |
328 |
+ |
// SNDCTL_DSP_SYNC, which may hang |
329 |
+ |
ioctl(audio_fd, SNDCTL_DSP_RESET, 0); |
330 |
+ |
} |
331 |
|
close(audio_fd); |
332 |
|
audio_fd = -1; |
333 |
|
} |