mirror of https://github.com/jitsi/jitsi-meet
Adapt to changes in the Android plugin initialization. Leverage the new module initialization to simplify enabling WebRTC logging.pull/13228/head jitsi-meet_8561
parent
e0e66119f5
commit
f88fa81616
@ -1,46 +0,0 @@ |
||||
/* |
||||
* Copyright 2017 The WebRTC project authors. All Rights Reserved. |
||||
* |
||||
* Use of this source code is governed by a BSD-style license |
||||
* that can be found in the LICENSE file in the root of the source |
||||
* tree. An additional intellectual property rights grant can be found |
||||
* in the file PATENTS. All contributing project authors may |
||||
* be found in the AUTHORS file in the root of the source tree. |
||||
*/ |
||||
|
||||
package org.jitsi.meet.sdk; |
||||
|
||||
import org.webrtc.VideoCodecInfo; |
||||
|
||||
import java.util.Map; |
||||
import java.util.HashMap; |
||||
|
||||
/** Container for static helper functions related to dealing with H264 codecs. */ |
||||
class H264Utils { |
||||
public static final String H264_FMTP_PROFILE_LEVEL_ID = "profile-level-id"; |
||||
public static final String H264_FMTP_LEVEL_ASYMMETRY_ALLOWED = "level-asymmetry-allowed"; |
||||
public static final String H264_FMTP_PACKETIZATION_MODE = "packetization-mode"; |
||||
|
||||
public static final String H264_PROFILE_CONSTRAINED_BASELINE = "42e0"; |
||||
public static final String H264_PROFILE_CONSTRAINED_HIGH = "640c"; |
||||
public static final String H264_LEVEL_3_1 = "1f"; // 31 in hex.
|
||||
public static final String H264_CONSTRAINED_HIGH_3_1 = |
||||
H264_PROFILE_CONSTRAINED_HIGH + H264_LEVEL_3_1; |
||||
public static final String H264_CONSTRAINED_BASELINE_3_1 = |
||||
H264_PROFILE_CONSTRAINED_BASELINE + H264_LEVEL_3_1; |
||||
|
||||
public static Map<String, String> getDefaultH264Params(boolean isHighProfile) { |
||||
final Map<String, String> params = new HashMap<>(); |
||||
params.put(VideoCodecInfo.H264_FMTP_LEVEL_ASYMMETRY_ALLOWED, "1"); |
||||
params.put(VideoCodecInfo.H264_FMTP_PACKETIZATION_MODE, "1"); |
||||
params.put(VideoCodecInfo.H264_FMTP_PROFILE_LEVEL_ID, |
||||
isHighProfile ? VideoCodecInfo.H264_CONSTRAINED_HIGH_3_1 |
||||
: VideoCodecInfo.H264_CONSTRAINED_BASELINE_3_1); |
||||
return params; |
||||
} |
||||
|
||||
public static VideoCodecInfo DEFAULT_H264_BASELINE_PROFILE_CODEC = |
||||
new VideoCodecInfo("H264", getDefaultH264Params(/* isHighProfile= */ false)); |
||||
public static VideoCodecInfo DEFAULT_H264_HIGH_PROFILE_CODEC = |
||||
new VideoCodecInfo("H264", getDefaultH264Params(/* isHighProfile= */ true)); |
||||
} |
@ -1,19 +0,0 @@ |
||||
package org.jitsi.meet.sdk; |
||||
|
||||
/** Enumeration of supported video codec types. */ |
||||
public enum VideoCodecMimeType { |
||||
VP8("video/x-vnd.on2.vp8"), |
||||
VP9("video/x-vnd.on2.vp9"), |
||||
H264("video/avc"), |
||||
AV1("video/av01"); |
||||
|
||||
private final String mimeType; |
||||
|
||||
private VideoCodecMimeType(String mimeType) { |
||||
this.mimeType = mimeType; |
||||
} |
||||
|
||||
String mimeType() { |
||||
return mimeType; |
||||
} |
||||
} |
@ -1,52 +0,0 @@ |
||||
package org.jitsi.meet.sdk; |
||||
|
||||
import androidx.annotation.Nullable; |
||||
|
||||
import org.webrtc.EglBase; |
||||
import org.webrtc.HardwareVideoDecoderFactory; |
||||
import org.webrtc.SoftwareVideoDecoderFactory; |
||||
import org.webrtc.VideoCodecInfo; |
||||
import org.webrtc.VideoDecoder; |
||||
import org.webrtc.VideoDecoderFactory; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* This is a custom video decoder factory for WebRTC which behaves similarly |
||||
* to the default one in iOS. It supports the following codecs: |
||||
* |
||||
* - In hardware: H.264 (baseline) |
||||
* - In software: VP8, VP9, AV1 |
||||
*/ |
||||
public class WebRTCVideoDecoderFactory implements VideoDecoderFactory { |
||||
private final VideoDecoderFactory hardwareVideoDecoderFactory; |
||||
private final VideoDecoderFactory softwareVideoDecoderFactory = new SoftwareVideoDecoderFactory(); |
||||
|
||||
public WebRTCVideoDecoderFactory(@Nullable EglBase.Context eglContext) { |
||||
this.hardwareVideoDecoderFactory = new HardwareVideoDecoderFactory(eglContext); |
||||
} |
||||
|
||||
@Nullable |
||||
@Override |
||||
public VideoDecoder createDecoder(VideoCodecInfo codecInfo) { |
||||
if (codecInfo.name.equalsIgnoreCase(VideoCodecMimeType.H264.name())) { |
||||
return this.hardwareVideoDecoderFactory.createDecoder(codecInfo); |
||||
} |
||||
|
||||
return this.softwareVideoDecoderFactory.createDecoder(codecInfo); |
||||
} |
||||
|
||||
@Override |
||||
public VideoCodecInfo[] getSupportedCodecs() { |
||||
List<VideoCodecInfo> codecs = new ArrayList<>(); |
||||
|
||||
codecs.add(H264Utils.DEFAULT_H264_BASELINE_PROFILE_CODEC); |
||||
codecs.add(new VideoCodecInfo(VideoCodecMimeType.VP8.name(), new HashMap<>())); |
||||
codecs.add(new VideoCodecInfo(VideoCodecMimeType.VP9.name(), new HashMap<>())); |
||||
codecs.add(new VideoCodecInfo(VideoCodecMimeType.AV1.name(), new HashMap<>())); |
||||
|
||||
return codecs.toArray(new VideoCodecInfo[codecs.size()]); |
||||
} |
||||
} |
@ -1,53 +0,0 @@ |
||||
package org.jitsi.meet.sdk; |
||||
|
||||
import androidx.annotation.Nullable; |
||||
|
||||
import org.webrtc.EglBase; |
||||
import org.webrtc.HardwareVideoEncoderFactory; |
||||
import org.webrtc.SoftwareVideoEncoderFactory; |
||||
import org.webrtc.VideoCodecInfo; |
||||
import org.webrtc.VideoEncoder; |
||||
import org.webrtc.VideoEncoderFactory; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* This is a custom video encoder factory for WebRTC which behaves similarly |
||||
* to the default one in iOS. It supports the following codecs: |
||||
* |
||||
* - In hardware: H.264 (baseline) |
||||
* - In software: VP8, VP9, AV1 |
||||
*/ |
||||
public class WebRTCVideoEncoderFactory implements VideoEncoderFactory { |
||||
private final VideoEncoderFactory hardwareVideoEncoderFactory; |
||||
private final VideoEncoderFactory softwareVideoEncoderFactory = new SoftwareVideoEncoderFactory(); |
||||
|
||||
public WebRTCVideoEncoderFactory(@Nullable EglBase.Context eglContext) { |
||||
this.hardwareVideoEncoderFactory = |
||||
new HardwareVideoEncoderFactory(eglContext, false, false); |
||||
} |
||||
|
||||
@Nullable |
||||
@Override |
||||
public VideoEncoder createEncoder(VideoCodecInfo codecInfo) { |
||||
if (codecInfo.name.equalsIgnoreCase(VideoCodecMimeType.H264.name())) { |
||||
return this.hardwareVideoEncoderFactory.createEncoder(codecInfo); |
||||
} |
||||
|
||||
return this.softwareVideoEncoderFactory.createEncoder(codecInfo); |
||||
} |
||||
|
||||
@Override |
||||
public VideoCodecInfo[] getSupportedCodecs() { |
||||
List<VideoCodecInfo> codecs = new ArrayList<>(); |
||||
|
||||
codecs.add(H264Utils.DEFAULT_H264_BASELINE_PROFILE_CODEC); |
||||
codecs.add(new VideoCodecInfo(VideoCodecMimeType.VP8.name(), new HashMap<>())); |
||||
codecs.add(new VideoCodecInfo(VideoCodecMimeType.VP9.name(), new HashMap<>())); |
||||
codecs.add(new VideoCodecInfo(VideoCodecMimeType.AV1.name(), new HashMap<>())); |
||||
|
||||
return codecs.toArray(new VideoCodecInfo[codecs.size()]); |
||||
} |
||||
} |
Loading…
Reference in new issue