Create WebRTC VideoTrack with "custom" Capturer on Android with libjingle

How to use a “custom” video capture tool to create a video driver and provide frames?

The classic approach to creating VideoTrack:

1 - Get an instance of VideoCapturer

VideoCapturer capturer = VideoCapturer.create(name); 

2 - Create a VideoSource

 VideoSource videoSource = peerconnectionFactory.createVideoSource(capturer, videoConstraints); 

3 - Create a VideoTrack using a video source

 VideoTrack videoTrack = peerconnectionFactory.createVideoTrack("Label", videoSource); 

4 - add track to MediaStream




I was wondering if there is a way to change step one . Instead of using a native Capturer instance, use Android one and provide VideoTrack frames with a callback:

 public void onPreviewFrame(byte[] data, Camera camera) { // provide the frames to the VideoTrack } 

Any suggestions?

+48
android webrtc libjingle
May 14 '14 at 12:13
source share
1 answer

The easiest way (albeit a bit "hacked") to do this is to copy the source of RTCVideoCapturer to a local class with your project and just use this local class. Now you can edit the class to suit your needs. Even if you are not copying the file, but creating it yourself, it is probably better to copy large parts of an existing invader than to reinvent the wheel.

+1
Feb 06 '15 at 14:34
source share



All Articles