WebRtc安卓自定义音频输入

huangapple 未分类评论48阅读模式
英文:

WebRtc android custom audio input

问题

我有一串类似于JavaAudioDeviceModule中WebRtc提供的短音频字节流。

我想将其发送到WebRtc后端。
唯一的方法是从中创建AudioTrack,然后添加到peerConnection吗?
如果是的,那么如何将自定义流提供给这个native c++指针?

package org.webrtc;

public class AudioTrack extends MediaStreamTrack {
    public AudioTrack(long nativeTrack) {
        super(nativeTrack);
    }

    public void setVolume(double volume) {
        nativeSetVolume(this.getNativeAudioTrack(), volume);
    }

    public long getNativeAudioTrack() {
        return this.getNativeMediaStreamTrack();
    }

    private static native void nativeSetVolume(long var0, double var2);
}
英文:

I have stream of shorts/bytes of audio the similar as WebRtc gives in JavaAudioDeviceModule.

I want to send it to WebRtc backend.
Is the only way to do it to create AudioTrack from it and add to peerConnection?
If yes, then how can I feed custom stream to this native c++ pointer?
package org.webrtc;

public class AudioTrack extends MediaStreamTrack {
    public AudioTrack(long nativeTrack) {
        super(nativeTrack);
    }

    public void setVolume(double volume) {
        nativeSetVolume(this.getNativeAudioTrack(), volume);
    }

    public long getNativeAudioTrack() {
        return this.getNativeMediaStreamTrack();
    }

    private static native void nativeSetVolume(long var0, double var2);
}

huangapple
  • 本文由 发表于 2020年7月23日 14:59:48
  • 转载请务必保留本文链接:https://java.coder-hub.com/63048609.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定