WebRTC with Usb Camera

118 views
Skip to first unread message

Peter Stoiber

unread,
Apr 14, 2020, 4:37:12 AM4/14/20
to discuss-webrtc
Hello,

the old version of webrtc supported a method in the VideoCapturer.CapturerObserver Interface to add custom frames over the method - onByteBufferFrameCaptured - directly over java.

In the newer Versions, I think I'll have to use this method:
void onFrameCaptured(VideoFrame frame);
from the CapturerObserver Interface.
But the new Class VideoFrame mostly contains @CalledByNative code.
Is it still possible to add a custom frame in a byte array from java to webrtc?

김주봉

unread,
Apr 14, 2020, 6:19:29 AM4/14/20
to discuss-webrtc
long timestampNS = TimeUnit.MILLISECONDS.toNanos(SystemClock.elapsedRealtime());
android.util.Size size = camera.getCurrentVideoResolution();
NV21Buffer buffer = new NV21Buffer(bytes, size.getWidth(), size.getHeight(), null);
VideoFrame videoFrame = new VideoFrame(buffer, 0, timestampNS);
capturerObserver.onFrameCaptured(videoFrame);


2020년 4월 14일 화요일 오후 5시 37분 12초 UTC+9, Peter Stoiber 님의 말:

Peter Stoiber

unread,
Apr 14, 2020, 3:07:46 PM4/14/20
to discuss-webrtc
Hello 김주봉 and thx for the answer,

I haven't looked for the NV21Class up to now, but this class looks sane for an implementation of an external frame byte-array.

One more thing,
are there other formats than NV21 for WebRTC too, because for an example the croma convertation from Mjpeg to NV21 takes a lot of system resources and highly increases the app size.

Thx,

Peter
Reply all
Reply to author
Forward
0 new messages