Lines 140-146
Link Here
|
140 |
} |
140 |
} |
141 |
|
141 |
|
142 |
void SndioAudioOutputStream::ThreadLoop(void) { |
142 |
void SndioAudioOutputStream::ThreadLoop(void) { |
143 |
int avail, count; |
143 |
int avail, count, result; |
144 |
|
144 |
|
145 |
while (state == kRunning) { |
145 |
while (state == kRunning) { |
146 |
// Update volume if needed |
146 |
// Update volume if needed |
Lines 152-158
Link Here
|
152 |
pthread_mutex_unlock(&mutex); |
152 |
pthread_mutex_unlock(&mutex); |
153 |
|
153 |
|
154 |
// Get data to play |
154 |
// Get data to play |
155 |
const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay, params.sample_rate() * 1000); |
155 |
const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay, |
|
|
156 |
params.sample_rate()); |
156 |
count = source->OnMoreData(delay, base::TimeTicks::Now(), 0, audio_bus.get()); |
157 |
count = source->OnMoreData(delay, base::TimeTicks::Now(), 0, audio_bus.get()); |
157 |
audio_bus->ToInterleaved(count, SampleFormatToBytesPerChannel(kSampleFormat), buffer); |
158 |
audio_bus->ToInterleaved(count, SampleFormatToBytesPerChannel(kSampleFormat), buffer); |
158 |
if (count == 0) { |
159 |
if (count == 0) { |
Lines 164-171
Link Here
|
164 |
|
165 |
|
165 |
// Submit data to the device |
166 |
// Submit data to the device |
166 |
avail = count * params.GetBytesPerFrame(kSampleFormat); |
167 |
avail = count * params.GetBytesPerFrame(kSampleFormat); |
167 |
count = sio_write(hdl, buffer, avail); |
168 |
result = sio_write(hdl, buffer, avail); |
168 |
if (count == 0) { |
169 |
if (result == 0) { |
169 |
LOG(WARNING) << "Audio device disconnected."; |
170 |
LOG(WARNING) << "Audio device disconnected."; |
170 |
break; |
171 |
break; |
171 |
} |
172 |
} |