jitsi / lib-jitsi-meet

A low-level JS video API that allows adding a completely custom video experience to web apps.
Apache License 2.0
1.34k stars 1.11k forks source link

Jitsi Meet P2P connection between Chrome and Android app #738

Open calamatitech opened 6 years ago

calamatitech commented 6 years ago

I deployed my own Jitsi Server server on Debian 8 using quick install guide, cloned and builded current jitsi meet web app. Furthermore, I cloned and builded the android app jitsi meet, using a local copy of lib-jitsi-meet and react-native-webrtc (to do some little changes: disable local x flip, set back camera as default, ecc...). I'm interested to use the system to estabilish peer to peer connections between a single Chrome and the android app. The system works well. I have only a little problem, concerning codec H264. When I estabilish a video/audio p2p connection between two Chrome, the used video codec is H264, as expected. When I establish a p2p connection between a single Chrome and the android app, the used codec is VP8. I inserted some console log instructions in setLocalDescription, to understand what is happening:

TraceablePeerConnection.prototype.setLocalDescription = function( description, successCallback, failureCallback) { let localSdp = description;

this.trace('setLocalDescription::preTransform', dumpSDP(localSdp));

if (this.options.disableH264 || this.options.preferH264) {
    const parsedSdp = transform.parse(localSdp.sdp);
    const videoMLine = parsedSdp.media.find(m => m.type === 'video');

    console.log ('videoMLine:');
    console.log (videoMLine);
    if (this.options.disableH264) {
       console.log ('stripVideoCodec H264');
        SDPUtil.stripVideoCodec(videoMLine, 'h264');
    } else {
        console.log ('preferVideoCodec H264');
        SDPUtil.preferVideoCodec(videoMLine, 'h264');
    }
    console.log ('videoMLine:');
    console.log (videoMLine);

    localSdp = new RTCSessionDescription({
        type: localSdp.type,
        sdp: transform.write(parsedSdp)
    });

    this.trace('setLocalDescription::postTransform (H264)',
        dumpSDP(localSdp));
}

........ From the resulting log, I observed that H264 is the favourite codec, but SDPUtil.preferVideoCodec could'nt set it as preferred, because videoMline did'nt contains the codec H264. In attach the complete log. log.txt

calamatitech commented 6 years ago

I read that in webrtc H264 should be hw supported; I tried to connect to Chrome with two smartphone, huawei nova young (basic) and huawei P10 (high end), once a time, but the chosen codec was always VP8. An app named MediaCodec says that both have hw H264 decoder/encoder (omx.mkt.video.decoder.avc and omx.mkt.video.encoder.avc), other than sw decoder/encoder (omx.google.h264.decoder and omx.google.h264.encoder)