804 lines
19 KiB
Smali
804 lines
19 KiB
Smali
.class public Lorg/webrtc/HardwareVideoEncoderFactory;
|
|
.super Ljava/lang/Object;
|
|
.source "HardwareVideoEncoderFactory.java"
|
|
|
|
# interfaces
|
|
.implements Lorg/webrtc/VideoEncoderFactory;
|
|
|
|
|
|
# static fields
|
|
.field public static final H264_HW_EXCEPTION_MODELS:Ljava/util/List;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/List<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field public static final QCOM_VP8_KEY_FRAME_INTERVAL_ANDROID_L_MS:I = 0x3a98
|
|
|
|
.field public static final QCOM_VP8_KEY_FRAME_INTERVAL_ANDROID_M_MS:I = 0x4e20
|
|
|
|
.field public static final QCOM_VP8_KEY_FRAME_INTERVAL_ANDROID_N_MS:I = 0x3a98
|
|
|
|
.field public static final TAG:Ljava/lang/String; = "HardwareVideoEncoderFactory"
|
|
|
|
|
|
# instance fields
|
|
.field public final enableH264HighProfile:Z
|
|
|
|
.field public final enableIntelVp8Encoder:Z
|
|
|
|
.field public final sharedContext:Lorg/webrtc/EglBase14$Context;
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 3
|
|
|
|
const-string v0, "SAMSUNG-SGH-I337"
|
|
|
|
const-string v1, "Nexus 7"
|
|
|
|
const-string v2, "Nexus 4"
|
|
|
|
filled-new-array {v0, v1, v2}, [Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0}, Ljava/util/Arrays;->asList([Ljava/lang/Object;)Ljava/util/List;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lorg/webrtc/HardwareVideoEncoderFactory;->H264_HW_EXCEPTION_MODELS:Ljava/util/List;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Lorg/webrtc/EglBase$Context;ZZ)V
|
|
.locals 1
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
instance-of v0, p1, Lorg/webrtc/EglBase14$Context;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
check-cast p1, Lorg/webrtc/EglBase14$Context;
|
|
|
|
iput-object p1, p0, Lorg/webrtc/HardwareVideoEncoderFactory;->sharedContext:Lorg/webrtc/EglBase14$Context;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const-string p1, "HardwareVideoEncoderFactory"
|
|
|
|
const-string v0, "No shared EglBase.Context. Encoders will not use texture mode."
|
|
|
|
invoke-static {p1, v0}, Lorg/webrtc/Logging;->w(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
iput-object p1, p0, Lorg/webrtc/HardwareVideoEncoderFactory;->sharedContext:Lorg/webrtc/EglBase14$Context;
|
|
|
|
:goto_0
|
|
iput-boolean p2, p0, Lorg/webrtc/HardwareVideoEncoderFactory;->enableIntelVp8Encoder:Z
|
|
|
|
iput-boolean p3, p0, Lorg/webrtc/HardwareVideoEncoderFactory;->enableH264HighProfile:Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(ZZ)V
|
|
.locals 1
|
|
.annotation runtime Ljava/lang/Deprecated;
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-direct {p0, v0, p1, p2}, Lorg/webrtc/HardwareVideoEncoderFactory;-><init>(Lorg/webrtc/EglBase$Context;ZZ)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private createBitrateAdjuster(Lorg/webrtc/VideoCodecType;Ljava/lang/String;)Lorg/webrtc/BitrateAdjuster;
|
|
.locals 1
|
|
|
|
const-string v0, "OMX.Exynos."
|
|
|
|
invoke-virtual {p2, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
move-result p2
|
|
|
|
if-eqz p2, :cond_1
|
|
|
|
sget-object p2, Lorg/webrtc/VideoCodecType;->VP8:Lorg/webrtc/VideoCodecType;
|
|
|
|
if-ne p1, p2, :cond_0
|
|
|
|
new-instance p1, Lorg/webrtc/DynamicBitrateAdjuster;
|
|
|
|
invoke-direct {p1}, Lorg/webrtc/DynamicBitrateAdjuster;-><init>()V
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
new-instance p1, Lorg/webrtc/FramerateBitrateAdjuster;
|
|
|
|
invoke-direct {p1}, Lorg/webrtc/FramerateBitrateAdjuster;-><init>()V
|
|
|
|
return-object p1
|
|
|
|
:cond_1
|
|
new-instance p1, Lorg/webrtc/BaseBitrateAdjuster;
|
|
|
|
invoke-direct {p1}, Lorg/webrtc/BaseBitrateAdjuster;-><init>()V
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method private findCodecForType(Lorg/webrtc/VideoCodecType;)Landroid/media/MediaCodecInfo;
|
|
.locals 5
|
|
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
invoke-static {}, Landroid/media/MediaCodecList;->getCodecCount()I
|
|
|
|
move-result v1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-ge v0, v1, :cond_2
|
|
|
|
:try_start_0
|
|
invoke-static {v0}, Landroid/media/MediaCodecList;->getCodecInfoAt(I)Landroid/media/MediaCodecInfo;
|
|
|
|
move-result-object v2
|
|
:try_end_0
|
|
.catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
goto :goto_1
|
|
|
|
:catch_0
|
|
move-exception v1
|
|
|
|
const-string v3, "HardwareVideoEncoderFactory"
|
|
|
|
const-string v4, "Cannot retrieve encoder codec info"
|
|
|
|
invoke-static {v3, v4, v1}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
:goto_1
|
|
if-eqz v2, :cond_1
|
|
|
|
invoke-virtual {v2}, Landroid/media/MediaCodecInfo;->isEncoder()Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
goto :goto_2
|
|
|
|
:cond_0
|
|
invoke-direct {p0, v2, p1}, Lorg/webrtc/HardwareVideoEncoderFactory;->isSupportedCodec(Landroid/media/MediaCodecInfo;Lorg/webrtc/VideoCodecType;)Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
return-object v2
|
|
|
|
:cond_1
|
|
:goto_2
|
|
add-int/lit8 v0, v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
return-object v2
|
|
.end method
|
|
|
|
.method private getForcedKeyFrameIntervalMs(Lorg/webrtc/VideoCodecType;Ljava/lang/String;)I
|
|
.locals 1
|
|
|
|
sget-object v0, Lorg/webrtc/VideoCodecType;->VP8:Lorg/webrtc/VideoCodecType;
|
|
|
|
if-ne p1, v0, :cond_3
|
|
|
|
const-string p1, "OMX.qcom."
|
|
|
|
invoke-virtual {p2, p1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_3
|
|
|
|
sget p1, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 p2, 0x15
|
|
|
|
const/16 v0, 0x3a98
|
|
|
|
if-eq p1, p2, :cond_2
|
|
|
|
const/16 p2, 0x16
|
|
|
|
if-ne p1, p2, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/16 p2, 0x17
|
|
|
|
if-ne p1, p2, :cond_1
|
|
|
|
const/16 p1, 0x4e20
|
|
|
|
return p1
|
|
|
|
:cond_1
|
|
if-le p1, p2, :cond_3
|
|
|
|
:cond_2
|
|
:goto_0
|
|
return v0
|
|
|
|
:cond_3
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method private getKeyFrameIntervalSec(Lorg/webrtc/VideoCodecType;)I
|
|
.locals 3
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Enum;->ordinal()I
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
const/4 v1, 0x1
|
|
|
|
if-eq v0, v1, :cond_1
|
|
|
|
const/4 v1, 0x2
|
|
|
|
if-ne v0, v1, :cond_0
|
|
|
|
const/16 p1, 0x14
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
new-instance v0, Ljava/lang/IllegalArgumentException;
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v2, "Unsupported VideoCodecType "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {v0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_1
|
|
const/16 p1, 0x64
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method private isH264HighProfileSupported(Landroid/media/MediaCodecInfo;)Z
|
|
.locals 2
|
|
|
|
iget-boolean v0, p0, Lorg/webrtc/HardwareVideoEncoderFactory;->enableH264HighProfile:Z
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x17
|
|
|
|
if-le v0, v1, :cond_0
|
|
|
|
invoke-virtual {p1}, Landroid/media/MediaCodecInfo;->getName()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string v0, "OMX.Exynos."
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
const/4 p1, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 p1, 0x0
|
|
|
|
:goto_0
|
|
return p1
|
|
.end method
|
|
|
|
.method private isHardwareSupportedInCurrentSdk(Landroid/media/MediaCodecInfo;Lorg/webrtc/VideoCodecType;)Z
|
|
.locals 1
|
|
|
|
invoke-virtual {p2}, Ljava/lang/Enum;->ordinal()I
|
|
|
|
move-result p2
|
|
|
|
if-eqz p2, :cond_2
|
|
|
|
const/4 v0, 0x1
|
|
|
|
if-eq p2, v0, :cond_1
|
|
|
|
const/4 v0, 0x2
|
|
|
|
if-eq p2, v0, :cond_0
|
|
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
invoke-direct {p0, p1}, Lorg/webrtc/HardwareVideoEncoderFactory;->isHardwareSupportedInCurrentSdkH264(Landroid/media/MediaCodecInfo;)Z
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
|
|
:cond_1
|
|
invoke-direct {p0, p1}, Lorg/webrtc/HardwareVideoEncoderFactory;->isHardwareSupportedInCurrentSdkVp9(Landroid/media/MediaCodecInfo;)Z
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
|
|
:cond_2
|
|
invoke-direct {p0, p1}, Lorg/webrtc/HardwareVideoEncoderFactory;->isHardwareSupportedInCurrentSdkVp8(Landroid/media/MediaCodecInfo;)Z
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method private isHardwareSupportedInCurrentSdkH264(Landroid/media/MediaCodecInfo;)Z
|
|
.locals 2
|
|
|
|
sget-object v0, Lorg/webrtc/HardwareVideoEncoderFactory;->H264_HW_EXCEPTION_MODELS:Ljava/util/List;
|
|
|
|
sget-object v1, Landroid/os/Build;->MODEL:Ljava/lang/String;
|
|
|
|
invoke-interface {v0, v1}, Ljava/util/List;->contains(Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
return v1
|
|
|
|
:cond_0
|
|
invoke-virtual {p1}, Landroid/media/MediaCodecInfo;->getName()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string v0, "OMX.qcom."
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
sget p1, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
const-string v0, "OMX.Exynos."
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_2
|
|
|
|
sget p1, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
:goto_0
|
|
const/4 v1, 0x1
|
|
|
|
:cond_2
|
|
return v1
|
|
.end method
|
|
|
|
.method private isHardwareSupportedInCurrentSdkVp8(Landroid/media/MediaCodecInfo;)Z
|
|
.locals 2
|
|
|
|
invoke-virtual {p1}, Landroid/media/MediaCodecInfo;->getName()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string v0, "OMX.qcom."
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
sget p1, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const-string v0, "OMX.Exynos."
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x17
|
|
|
|
if-ge v0, v1, :cond_2
|
|
|
|
:cond_1
|
|
const-string v0, "OMX.Intel."
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_3
|
|
|
|
sget p1, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
iget-boolean p1, p0, Lorg/webrtc/HardwareVideoEncoderFactory;->enableIntelVp8Encoder:Z
|
|
|
|
if-eqz p1, :cond_3
|
|
|
|
:cond_2
|
|
:goto_0
|
|
const/4 p1, 0x1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_3
|
|
const/4 p1, 0x0
|
|
|
|
:goto_1
|
|
return p1
|
|
.end method
|
|
|
|
.method private isHardwareSupportedInCurrentSdkVp9(Landroid/media/MediaCodecInfo;)Z
|
|
.locals 1
|
|
|
|
invoke-virtual {p1}, Landroid/media/MediaCodecInfo;->getName()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string v0, "OMX.qcom."
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const-string v0, "OMX.Exynos."
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
:cond_0
|
|
sget p1, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v0, 0x18
|
|
|
|
if-lt p1, v0, :cond_1
|
|
|
|
const/4 p1, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
const/4 p1, 0x0
|
|
|
|
:goto_0
|
|
return p1
|
|
.end method
|
|
|
|
.method private isSupportedCodec(Landroid/media/MediaCodecInfo;Lorg/webrtc/VideoCodecType;)Z
|
|
.locals 3
|
|
|
|
invoke-static {p1, p2}, Lorg/webrtc/MediaCodecUtils;->codecSupportsType(Landroid/media/MediaCodecInfo;Lorg/webrtc/VideoCodecType;)Z
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
return v1
|
|
|
|
:cond_0
|
|
sget-object v0, Lorg/webrtc/MediaCodecUtils;->ENCODER_COLOR_FORMATS:[I
|
|
|
|
invoke-virtual {p2}, Lorg/webrtc/VideoCodecType;->mimeType()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {p1, v2}, Landroid/media/MediaCodecInfo;->getCapabilitiesForType(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-static {v0, v2}, Lorg/webrtc/MediaCodecUtils;->selectColorFormat([ILandroid/media/MediaCodecInfo$CodecCapabilities;)Ljava/lang/Integer;
|
|
|
|
move-result-object v0
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
return v1
|
|
|
|
:cond_1
|
|
invoke-direct {p0, p1, p2}, Lorg/webrtc/HardwareVideoEncoderFactory;->isHardwareSupportedInCurrentSdk(Landroid/media/MediaCodecInfo;Lorg/webrtc/VideoCodecType;)Z
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public createEncoder(Lorg/webrtc/VideoCodecInfo;)Lorg/webrtc/VideoEncoder;
|
|
.locals 12
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
iget-object v0, p1, Lorg/webrtc/VideoCodecInfo;->name:Ljava/lang/String;
|
|
|
|
invoke-static {v0}, Lorg/webrtc/VideoCodecType;->valueOf(Ljava/lang/String;)Lorg/webrtc/VideoCodecType;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-direct {p0, v4}, Lorg/webrtc/HardwareVideoEncoderFactory;->findCodecForType(Lorg/webrtc/VideoCodecType;)Landroid/media/MediaCodecInfo;
|
|
|
|
move-result-object v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
return-object v1
|
|
|
|
:cond_0
|
|
invoke-virtual {v0}, Landroid/media/MediaCodecInfo;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v4}, Lorg/webrtc/VideoCodecType;->mimeType()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
sget-object v5, Lorg/webrtc/MediaCodecUtils;->TEXTURE_COLOR_FORMATS:[I
|
|
|
|
invoke-virtual {v0, v2}, Landroid/media/MediaCodecInfo;->getCapabilitiesForType(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;
|
|
|
|
move-result-object v6
|
|
|
|
invoke-static {v5, v6}, Lorg/webrtc/MediaCodecUtils;->selectColorFormat([ILandroid/media/MediaCodecInfo$CodecCapabilities;)Ljava/lang/Integer;
|
|
|
|
move-result-object v5
|
|
|
|
sget-object v6, Lorg/webrtc/MediaCodecUtils;->ENCODER_COLOR_FORMATS:[I
|
|
|
|
invoke-virtual {v0, v2}, Landroid/media/MediaCodecInfo;->getCapabilitiesForType(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-static {v6, v2}, Lorg/webrtc/MediaCodecUtils;->selectColorFormat([ILandroid/media/MediaCodecInfo$CodecCapabilities;)Ljava/lang/Integer;
|
|
|
|
move-result-object v6
|
|
|
|
sget-object v2, Lorg/webrtc/VideoCodecType;->H264:Lorg/webrtc/VideoCodecType;
|
|
|
|
if-ne v4, v2, :cond_2
|
|
|
|
iget-object v2, p1, Lorg/webrtc/VideoCodecInfo;->params:Ljava/util/Map;
|
|
|
|
const/4 v7, 0x1
|
|
|
|
invoke-static {v4, v7}, Lorg/webrtc/MediaCodecUtils;->getCodecProperties(Lorg/webrtc/VideoCodecType;Z)Ljava/util/Map;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-static {v2, v7}, Lorg/webrtc/H264Utils;->isSameH264Profile(Ljava/util/Map;Ljava/util/Map;)Z
|
|
|
|
move-result v2
|
|
|
|
iget-object v7, p1, Lorg/webrtc/VideoCodecInfo;->params:Ljava/util/Map;
|
|
|
|
const/4 v8, 0x0
|
|
|
|
invoke-static {v4, v8}, Lorg/webrtc/MediaCodecUtils;->getCodecProperties(Lorg/webrtc/VideoCodecType;Z)Ljava/util/Map;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-static {v7, v8}, Lorg/webrtc/H264Utils;->isSameH264Profile(Ljava/util/Map;Ljava/util/Map;)Z
|
|
|
|
move-result v7
|
|
|
|
if-nez v2, :cond_1
|
|
|
|
if-nez v7, :cond_1
|
|
|
|
return-object v1
|
|
|
|
:cond_1
|
|
if-eqz v2, :cond_2
|
|
|
|
invoke-direct {p0, v0}, Lorg/webrtc/HardwareVideoEncoderFactory;->isH264HighProfileSupported(Landroid/media/MediaCodecInfo;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_2
|
|
|
|
return-object v1
|
|
|
|
:cond_2
|
|
new-instance v0, Lorg/webrtc/HardwareVideoEncoder;
|
|
|
|
new-instance v2, Lorg/webrtc/MediaCodecWrapperFactoryImpl;
|
|
|
|
invoke-direct {v2}, Lorg/webrtc/MediaCodecWrapperFactoryImpl;-><init>()V
|
|
|
|
iget-object v7, p1, Lorg/webrtc/VideoCodecInfo;->params:Ljava/util/Map;
|
|
|
|
invoke-direct {p0, v4}, Lorg/webrtc/HardwareVideoEncoderFactory;->getKeyFrameIntervalSec(Lorg/webrtc/VideoCodecType;)I
|
|
|
|
move-result v8
|
|
|
|
invoke-direct {p0, v4, v3}, Lorg/webrtc/HardwareVideoEncoderFactory;->getForcedKeyFrameIntervalMs(Lorg/webrtc/VideoCodecType;Ljava/lang/String;)I
|
|
|
|
move-result v9
|
|
|
|
invoke-direct {p0, v4, v3}, Lorg/webrtc/HardwareVideoEncoderFactory;->createBitrateAdjuster(Lorg/webrtc/VideoCodecType;Ljava/lang/String;)Lorg/webrtc/BitrateAdjuster;
|
|
|
|
move-result-object v10
|
|
|
|
iget-object v11, p0, Lorg/webrtc/HardwareVideoEncoderFactory;->sharedContext:Lorg/webrtc/EglBase14$Context;
|
|
|
|
move-object v1, v0
|
|
|
|
invoke-direct/range {v1 .. v11}, Lorg/webrtc/HardwareVideoEncoder;-><init>(Lorg/webrtc/MediaCodecWrapperFactory;Ljava/lang/String;Lorg/webrtc/VideoCodecType;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/Map;IILorg/webrtc/BitrateAdjuster;Lorg/webrtc/EglBase14$Context;)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public getSupportedCodecs()[Lorg/webrtc/VideoCodecInfo;
|
|
.locals 10
|
|
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
const/4 v1, 0x3
|
|
|
|
new-array v1, v1, [Lorg/webrtc/VideoCodecType;
|
|
|
|
sget-object v2, Lorg/webrtc/VideoCodecType;->VP8:Lorg/webrtc/VideoCodecType;
|
|
|
|
const/4 v3, 0x0
|
|
|
|
aput-object v2, v1, v3
|
|
|
|
sget-object v2, Lorg/webrtc/VideoCodecType;->VP9:Lorg/webrtc/VideoCodecType;
|
|
|
|
const/4 v4, 0x1
|
|
|
|
aput-object v2, v1, v4
|
|
|
|
const/4 v2, 0x2
|
|
|
|
sget-object v5, Lorg/webrtc/VideoCodecType;->H264:Lorg/webrtc/VideoCodecType;
|
|
|
|
aput-object v5, v1, v2
|
|
|
|
array-length v2, v1
|
|
|
|
const/4 v5, 0x0
|
|
|
|
:goto_0
|
|
if-ge v5, v2, :cond_2
|
|
|
|
aget-object v6, v1, v5
|
|
|
|
invoke-direct {p0, v6}, Lorg/webrtc/HardwareVideoEncoderFactory;->findCodecForType(Lorg/webrtc/VideoCodecType;)Landroid/media/MediaCodecInfo;
|
|
|
|
move-result-object v7
|
|
|
|
if-eqz v7, :cond_1
|
|
|
|
invoke-virtual {v6}, Ljava/lang/Enum;->name()Ljava/lang/String;
|
|
|
|
move-result-object v8
|
|
|
|
sget-object v9, Lorg/webrtc/VideoCodecType;->H264:Lorg/webrtc/VideoCodecType;
|
|
|
|
if-ne v6, v9, :cond_0
|
|
|
|
invoke-direct {p0, v7}, Lorg/webrtc/HardwareVideoEncoderFactory;->isH264HighProfileSupported(Landroid/media/MediaCodecInfo;)Z
|
|
|
|
move-result v7
|
|
|
|
if-eqz v7, :cond_0
|
|
|
|
new-instance v7, Lorg/webrtc/VideoCodecInfo;
|
|
|
|
invoke-static {v6, v4}, Lorg/webrtc/MediaCodecUtils;->getCodecProperties(Lorg/webrtc/VideoCodecType;Z)Ljava/util/Map;
|
|
|
|
move-result-object v9
|
|
|
|
invoke-direct {v7, v8, v9}, Lorg/webrtc/VideoCodecInfo;-><init>(Ljava/lang/String;Ljava/util/Map;)V
|
|
|
|
invoke-interface {v0, v7}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
:cond_0
|
|
new-instance v7, Lorg/webrtc/VideoCodecInfo;
|
|
|
|
invoke-static {v6, v3}, Lorg/webrtc/MediaCodecUtils;->getCodecProperties(Lorg/webrtc/VideoCodecType;Z)Ljava/util/Map;
|
|
|
|
move-result-object v6
|
|
|
|
invoke-direct {v7, v8, v6}, Lorg/webrtc/VideoCodecInfo;-><init>(Ljava/lang/String;Ljava/util/Map;)V
|
|
|
|
invoke-interface {v0, v7}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
:cond_1
|
|
add-int/lit8 v5, v5, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
invoke-interface {v0}, Ljava/util/List;->size()I
|
|
|
|
move-result v1
|
|
|
|
new-array v1, v1, [Lorg/webrtc/VideoCodecInfo;
|
|
|
|
invoke-interface {v0, v1}, Ljava/util/List;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, [Lorg/webrtc/VideoCodecInfo;
|
|
|
|
return-object v0
|
|
.end method
|