haiyangwu / mediasoup-client-android

mediasoup android client side library https://mediasoup.org
MIT License
178 stars 107 forks source link

Add PeerConnection.Options to Device.load() #42

Closed skgwazap closed 1 year ago

skgwazap commented 3 years ago

I'm not a C++ dev at all, so it's just a monkey copy-pasting some code from JNI_Device_CreateSendTransport to JNI_Device_Load.

What was done:

Why was it done? To fix the issue #12, the problem is with multiple instances of PeerConnectionFactory created by mediasoup-client internally. So, applications must provide a shared instance using options in Device.load Device.createSendTransport and Device.createRecvTransport

final String routerRtpCapabilities = mProtoo.syncRequest("getRouterRtpCapabilities");
final PeerConnection.Options options = new PeerConnection.Options();
options.setFactory(mPeerConnectionUtils.getSharedPeerConnectionFactory(mContext));
mMediasoupDevice = new Device();
mMediasoupDevice.load(routerRtpCapabilities, options);
haiyangwu commented 1 year ago

LGTM, thx @yinbiaos @skgwazap

btw, the project will be restarted.