I'm developing a native WebRTC android application, in my previous project I did just fine with these options, but now I'm unable to receive media stream when I publish my media, here is my code:
void startLocalVideoCapturing() {
localVideoCapturer = WebRtcCapturer.createCapturer(this);
Log.e(tag, "Local video capturer: " + localVideoCapturer);
if (localVideoCapturer != null) {
SurfaceTextureHelper surfaceTextureHelper = SurfaceTextureHelper.create("captured thread", EglBase.create().getEglBaseContext());
assert localStream != null;
localVideoSource = localStream.getVideoSource();
localVideoCapturer.initialize(surfaceTextureHelper, this, localVideoSource.getCapturerObserver());
localVideoCapturer.startCapture(1280, 720, 30);
localVideoTrack = localStream.getVideoTrack();
localVideoTrack.setEnabled(true);
localSurfaceRenderer.setVisibility(View.VISIBLE);
localSurfaceRenderer.setMirror(true);
localSurfaceRenderer.setEnableHardwareScaler(true);
localVideoTrack.addSink(localSurfaceRenderer);
}
}
Here is the code for getting VideoCapturer
:
public static VideoCapturer createCapturer(Context context) {
CameraEnumerator enumerator;
if (Camera2Enumerator.isSupported(context)) {
enumerator = new Camera2Enumerator(context);
} else {
enumerator = new Camera1Enumerator(false);
}
String[] deviceNames = enumerator.getDeviceNames();
for (String deviceName : deviceNames) {
List<CameraEnumerationAndroid.CaptureFormat> formatList = enumerator.getSupportedFormats(deviceName);
CameraEnumerationAndroid.CaptureFormat selectedFormat = formatList.get(formatList.size() - 1); // Default to lowest
for (CameraEnumerationAndroid.CaptureFormat format : enumerator.getSupportedFormats(deviceName)) {
selectedFormat = format;
break;
}
if (enumerator.isFrontFacing(deviceName)) {
CameraVideoCapturer capturer = enumerator.createCapturer(deviceName, null);
if (capturer != null) {
WebRtcCapturer fancyWebRTCCapturer = new WebRtcCapturer(capturer);
fancyWebRTCCapturer.setFormat(selectedFormat);
return capturer;
}
}
}
for (String deviceName : deviceNames) {
if (!enumerator.isFrontFacing(deviceName)) {
List<CameraEnumerationAndroid.CaptureFormat> formatList = enumerator.getSupportedFormats(deviceName);
CameraEnumerationAndroid.CaptureFormat selectedFormat = formatList.get(formatList.size() - 1); // Default to lowest
for (CameraEnumerationAndroid.CaptureFormat format : enumerator.getSupportedFormats(deviceName)) {
selectedFormat = format;
break;
}
CameraVideoCapturer capturer = enumerator.createCapturer(deviceName, null);
if (capturer != null) {
WebRtcCapturer fancyWebRTCCapturer = new WebRtcCapturer(capturer);
fancyWebRTCCapturer.setFormat(selectedFormat);
return capturer;
}
}
}
return null;
}
Here is the partial log:
I/chatty: uid=10163(com.namvdo.ion_sdk_android) captured thread identical 42 lines
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/chatty: uid=10163(com.namvdo.ion_sdk_android) captured thread identical 1 line
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/chatty: uid=10163(com.namvdo.ion_sdk_android) captured thread identical 1 line
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/chatty: uid=10163(com.namvdo.ion_sdk_android) captured thread identical 6 lines
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/org.webrtc.Logging: CameraStatistics: Camera fps: 30.
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/chatty: uid=10163(com.namvdo.ion_sdk_android) captured thread identical 11 lines
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/chatty: uid=10163(com.namvdo.ion_sdk_android) captured thread identical 24 lines
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/chatty: uid=10163(com.namvdo.ion_sdk_android) captured thread identical 19 lines
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
I/org.webrtc.Logging: CameraStatistics: Camera fps: 30.
I/org.webrtc.Logging: EglRenderer: local_viewDropping frame - Not initialized or already released.
Here is everything I got when trying to capture media:
Thanks for any help.