pushReferenceAudioPCMData method
@detail api
@region Custom Audio AEC Reference
@author cuiyao
@brief Push custom aec reference audio data to the RTC SDK.
@param audioFrame Audio data frame. See AudioFrame{@link #AudioFrame}
@return Method call result
+ 0: Success
+ <-1: Failure
@note
+ You should send audio data every 10 milliseconds since the duration of a RTC SDK audio frame is 10 milliseconds. Samples x call frequency = audioFrame's sample rate. Assume that the sampling rate is set to 48000, call this API every 10 ms, so that 480 sampling points should be pulled each time.
+ The audio sampling format is S16. The data format in the audio buffer is PCM data, and its capacity size is audioFrame.samples × audioFrame.channel × 2.
Implementation
Future<int?> pushReferenceAudioPCMData(AudioFrame audioFrame) async {
$a() => ($instance as $p_a.RTCEngine)
.pushReferenceAudioPCMData(unpackObject<$p_a.AudioFrame>(audioFrame));
$i() => ($instance as $p_i.ByteRTCEngine).pushReferenceAudioPCMData(
unpackObject<$p_i.ByteRTCAudioFrame>(audioFrame));
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}