-
Notifications
You must be signed in to change notification settings - Fork 209
Audio_Frame
chriszeng87 edited this page May 25, 2017
·
4 revisions
SDK提供OnAudioRawData回调返回原始的音频数据,开发者可以通过原始数据自定义处理(例如:噪声消除、变调等)
- 接口:
com.ksyun.media.streamer.kit.OnAudioRawDataListener
- 设置方式:通过KSYStreamer的接口setOnAudioRawDataListener接口来设置
- 回调触发时机:硬编、软编、软编兼容模式下均在推流过程中触发
- 自定义音频帧数据处理生效:三种模式下,预览和播放端均可体现
注:v4.x该接口不再维护,不建议您使用该回调,您可以通过自定义音频滤镜来实现,方式参考自定义音频滤镜的<1.2 自定义音频滤镜>
public interface OnAudioRawDataListener {
/**
* Called on every audio frame captured.
*
* @param data audio frame data in 44100Hz 16bit mono.
* @param count sample count
* @return filtered audio data in the same format.
*/
short[] OnAudioRawData(short[] data, int count);
}
mStreamer.setOnAudioRawDataListener(mOnAudioRawDataListener);
private OnAudioRawDataListener mOnAudioRawDataListener = new OnAudioRawDataListener() {
@Override
public short[] OnAudioRawData(short[] data, int count) {
//audio pcm data
return data;
}
};