Ask about the "mac pro sound rendering" question

19 views
Skip to first unread message

qidong liang

unread,
Nov 25, 2021, 10:31:31 PM11/25/21
to webrtc-jingle
Reading the audio_device_mac.cc code of webrtc mac, I don’t understand why this is done? The code is as follows:
if (&& _macBookProPanRight
&& (_playChannels == 2)) {
// Mix entirely into the right channel and zero the left channel.
SInt32 sampleInt32 = 0;
for (uint32_t sampleIdx = 0; sampleIdx < nOutSamples; sampleIdx += 2) {
sampleInt32 = pPlayBuffer[sampleIdx];
sampleInt32 += pPlayBuffer[sampleIdx + 1];
sampleInt32 /= 2;

if (sampleInt32 > 32767) {
sampleInt32 = 32767;
} else if (sampleInt32 < -32768) {
sampleInt32 = -32768;
}

pPlayBuffer[sampleIdx] = 0;
pPlayBuffer[sampleIdx + 1] = static_cast<SInt16>(sampleInt32);
}
}
Reply all
Reply to author
Forward
0 new messages