Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EncodeProvider.getProvider()一直是null #2

Open
yangyue1 opened this issue Jul 22, 2020 · 1 comment
Open

EncodeProvider.getProvider()一直是null #2

yangyue1 opened this issue Jul 22, 2020 · 1 comment

Comments

@yangyue1
Copy link

你好,我是在看您的项目中给videocalling那个项目加入音频,我调试中EncodeProvider.getProvider()一直是null,已经成功调用了麦克风,但是还是null,不知道是什么原因,希望您有空教一下我,感谢!

@LostStarTvT
Copy link
Owner

LostStarTvT commented Jul 31, 2020

EncodeProvider这个是需要先进行构造才行,如下:

public static EncodeProvider getProvider() {
    if (provider != null) {
        return provider;
    }
    return null;
}

//整合发送类和接收类。 此为构造方法
public EncodeProvider(String targetIp, int targetPort, int bindPort, final NettyReceiverHandler.FrameResultedCallback frameResultedCallback) {
    // 1配置client的信息,目标ip和端口。
    nettyClient = new NettyClient.
        Builder()
        .targetIp(targetIp)
        .targetport(targetPort)
        .localPort(bindPort)
        .frameResultedCallback(frameResultedCallback) //返回处理过后的数据
        .build();
    provider = this;
}

另外,这个provider是在VoipP2PActivity中netInit()方法中初始化的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants