999 lines
25 KiB
Smali
999 lines
25 KiB
Smali
|
.class public Lorg/webrtc/voiceengine/WebRtcAudioManager;
|
||
|
.super Ljava/lang/Object;
|
||
|
.source "WebRtcAudioManager.java"
|
||
|
|
||
|
|
||
|
# annotations
|
||
|
.annotation system Ldalvik/annotation/MemberClasses;
|
||
|
value = {
|
||
|
Lorg/webrtc/voiceengine/WebRtcAudioManager$VolumeLogger;
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
|
||
|
# static fields
|
||
|
.field public static final BITS_PER_SAMPLE:I = 0x10
|
||
|
|
||
|
.field public static final DEBUG:Z = false
|
||
|
|
||
|
.field public static final DEFAULT_FRAME_PER_BUFFER:I = 0x100
|
||
|
|
||
|
.field public static final TAG:Ljava/lang/String; = "WebRtcAudioManager"
|
||
|
|
||
|
.field public static final blacklistDeviceForAAudioUsage:Z = true
|
||
|
|
||
|
.field public static blacklistDeviceForOpenSLESUsage:Z
|
||
|
|
||
|
.field public static blacklistDeviceForOpenSLESUsageIsOverridden:Z
|
||
|
|
||
|
.field public static useStereoInput:Z
|
||
|
|
||
|
.field public static useStereoOutput:Z
|
||
|
|
||
|
|
||
|
# instance fields
|
||
|
.field public aAudio:Z
|
||
|
|
||
|
.field public final audioManager:Landroid/media/AudioManager;
|
||
|
|
||
|
.field public hardwareAEC:Z
|
||
|
|
||
|
.field public hardwareAGC:Z
|
||
|
|
||
|
.field public hardwareNS:Z
|
||
|
|
||
|
.field public initialized:Z
|
||
|
|
||
|
.field public inputBufferSize:I
|
||
|
|
||
|
.field public inputChannels:I
|
||
|
|
||
|
.field public lowLatencyInput:Z
|
||
|
|
||
|
.field public lowLatencyOutput:Z
|
||
|
|
||
|
.field public final nativeAudioManager:J
|
||
|
|
||
|
.field public nativeChannels:I
|
||
|
|
||
|
.field public nativeSampleRate:I
|
||
|
|
||
|
.field public outputBufferSize:I
|
||
|
|
||
|
.field public outputChannels:I
|
||
|
|
||
|
.field public proAudio:Z
|
||
|
|
||
|
.field public sampleRate:I
|
||
|
|
||
|
.field public final volumeLogger:Lorg/webrtc/voiceengine/WebRtcAudioManager$VolumeLogger;
|
||
|
|
||
|
|
||
|
# direct methods
|
||
|
.method public constructor <init>(J)V
|
||
|
.locals 17
|
||
|
|
||
|
move-object/from16 v15, p0
|
||
|
|
||
|
invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V
|
||
|
|
||
|
const-string v0, "ctor"
|
||
|
|
||
|
invoke-static {v0}, Lf/e/c/a/a;->E(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioUtils;->getThreadInfo()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v13, "WebRtcAudioManager"
|
||
|
|
||
|
invoke-static {v13, v0}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V
|
||
|
|
||
|
move-wide/from16 v11, p1
|
||
|
|
||
|
iput-wide v11, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->nativeAudioManager:J
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/ContextUtils;->getApplicationContext()Landroid/content/Context;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v1, "audio"
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
check-cast v0, Landroid/media/AudioManager;
|
||
|
|
||
|
iput-object v0, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->audioManager:Landroid/media/AudioManager;
|
||
|
|
||
|
new-instance v1, Lorg/webrtc/voiceengine/WebRtcAudioManager$VolumeLogger;
|
||
|
|
||
|
invoke-direct {v1, v0}, Lorg/webrtc/voiceengine/WebRtcAudioManager$VolumeLogger;-><init>(Landroid/media/AudioManager;)V
|
||
|
|
||
|
iput-object v1, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->volumeLogger:Lorg/webrtc/voiceengine/WebRtcAudioManager$VolumeLogger;
|
||
|
|
||
|
invoke-direct/range {p0 .. p0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->storeAudioParameters()V
|
||
|
|
||
|
iget v1, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->sampleRate:I
|
||
|
|
||
|
iget v2, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->outputChannels:I
|
||
|
|
||
|
iget v3, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->inputChannels:I
|
||
|
|
||
|
iget-boolean v4, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->hardwareAEC:Z
|
||
|
|
||
|
iget-boolean v5, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->hardwareAGC:Z
|
||
|
|
||
|
iget-boolean v6, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->hardwareNS:Z
|
||
|
|
||
|
iget-boolean v7, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->lowLatencyOutput:Z
|
||
|
|
||
|
iget-boolean v8, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->lowLatencyInput:Z
|
||
|
|
||
|
iget-boolean v9, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->proAudio:Z
|
||
|
|
||
|
iget-boolean v10, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->aAudio:Z
|
||
|
|
||
|
iget v14, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->outputBufferSize:I
|
||
|
|
||
|
iget v0, v15, Lorg/webrtc/voiceengine/WebRtcAudioManager;->inputBufferSize:I
|
||
|
|
||
|
move/from16 v16, v0
|
||
|
|
||
|
move-object/from16 v0, p0
|
||
|
|
||
|
move v11, v14
|
||
|
|
||
|
move/from16 v12, v16
|
||
|
|
||
|
move-object/from16 v16, v13
|
||
|
|
||
|
move-wide/from16 v13, p1
|
||
|
|
||
|
invoke-direct/range {v0 .. v14}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->nativeCacheAudioParameters(IIIZZZZZZZIIJ)V
|
||
|
|
||
|
invoke-static/range {v16 .. v16}, Lorg/webrtc/voiceengine/WebRtcAudioUtils;->logAudioState(Ljava/lang/String;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public static assertTrue(Z)V
|
||
|
.locals 1
|
||
|
|
||
|
if-eqz p0, :cond_0
|
||
|
|
||
|
return-void
|
||
|
|
||
|
:cond_0
|
||
|
new-instance p0, Ljava/lang/AssertionError;
|
||
|
|
||
|
const-string v0, "Expected condition to be true"
|
||
|
|
||
|
invoke-direct {p0, v0}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
|
||
|
|
||
|
throw p0
|
||
|
.end method
|
||
|
|
||
|
.method private dispose()V
|
||
|
.locals 2
|
||
|
|
||
|
const-string v0, "dispose"
|
||
|
|
||
|
invoke-static {v0}, Lf/e/c/a/a;->E(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioUtils;->getThreadInfo()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v1, "WebRtcAudioManager"
|
||
|
|
||
|
invoke-static {v1, v0}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V
|
||
|
|
||
|
iget-boolean v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->initialized:Z
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
return-void
|
||
|
|
||
|
:cond_0
|
||
|
iget-object v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->volumeLogger:Lorg/webrtc/voiceengine/WebRtcAudioManager$VolumeLogger;
|
||
|
|
||
|
invoke-static {v0}, Lorg/webrtc/voiceengine/WebRtcAudioManager$VolumeLogger;->access$100(Lorg/webrtc/voiceengine/WebRtcAudioManager$VolumeLogger;)V
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method private getLowLatencyInputFramesPerBuffer()I
|
||
|
.locals 1
|
||
|
|
||
|
invoke-virtual {p0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->isLowLatencyInputSupported()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
invoke-static {v0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->assertTrue(Z)V
|
||
|
|
||
|
invoke-direct {p0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->getLowLatencyOutputFramesPerBuffer()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method private getLowLatencyOutputFramesPerBuffer()I
|
||
|
.locals 2
|
||
|
|
||
|
invoke-direct {p0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->isLowLatencyOutputSupported()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
invoke-static {v0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->assertTrue(Z)V
|
||
|
|
||
|
iget-object v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->audioManager:Landroid/media/AudioManager;
|
||
|
|
||
|
const-string v1, "android.media.property.OUTPUT_FRAMES_PER_BUFFER"
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroid/media/AudioManager;->getProperty(Ljava/lang/String;)Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
const/16 v0, 0x100
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:cond_0
|
||
|
invoke-static {v0}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
:goto_0
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method public static getMinInputFrameSize(II)I
|
||
|
.locals 2
|
||
|
|
||
|
mul-int/lit8 v0, p1, 0x2
|
||
|
|
||
|
const/4 v1, 0x1
|
||
|
|
||
|
if-ne p1, v1, :cond_0
|
||
|
|
||
|
const/16 p1, 0x10
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:cond_0
|
||
|
const/16 p1, 0xc
|
||
|
|
||
|
:goto_0
|
||
|
const/4 v1, 0x2
|
||
|
|
||
|
invoke-static {p0, p1, v1}, Landroid/media/AudioRecord;->getMinBufferSize(III)I
|
||
|
|
||
|
move-result p0
|
||
|
|
||
|
div-int/2addr p0, v0
|
||
|
|
||
|
return p0
|
||
|
.end method
|
||
|
|
||
|
.method public static getMinOutputFrameSize(II)I
|
||
|
.locals 2
|
||
|
|
||
|
mul-int/lit8 v0, p1, 0x2
|
||
|
|
||
|
const/4 v1, 0x1
|
||
|
|
||
|
if-ne p1, v1, :cond_0
|
||
|
|
||
|
const/4 p1, 0x4
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:cond_0
|
||
|
const/16 p1, 0xc
|
||
|
|
||
|
:goto_0
|
||
|
const/4 v1, 0x2
|
||
|
|
||
|
invoke-static {p0, p1, v1}, Landroid/media/AudioTrack;->getMinBufferSize(III)I
|
||
|
|
||
|
move-result p0
|
||
|
|
||
|
div-int/2addr p0, v0
|
||
|
|
||
|
return p0
|
||
|
.end method
|
||
|
|
||
|
.method private getNativeOutputSampleRate()I
|
||
|
.locals 5
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioUtils;->runningOnEmulator()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
const-string v1, "WebRtcAudioManager"
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
const-string v0, "Running emulator, overriding sample rate to 8 kHz."
|
||
|
|
||
|
invoke-static {v1, v0}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V
|
||
|
|
||
|
const/16 v0, 0x1f40
|
||
|
|
||
|
return v0
|
||
|
|
||
|
:cond_0
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioUtils;->isDefaultSampleRateOverridden()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
const-string v2, " Hz"
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
const-string v0, "Default sample rate is overriden to "
|
||
|
|
||
|
invoke-static {v0}, Lf/e/c/a/a;->E(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioUtils;->getDefaultSampleRateHz()I
|
||
|
|
||
|
move-result v3
|
||
|
|
||
|
invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-static {v1, v0}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioUtils;->getDefaultSampleRateHz()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
return v0
|
||
|
|
||
|
:cond_1
|
||
|
invoke-direct {p0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->getSampleRateForApiLevel()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
new-instance v3, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v4, "Sample rate is set to "
|
||
|
|
||
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v3, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-static {v1, v2}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V
|
||
|
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method private getSampleRateForApiLevel()I
|
||
|
.locals 2
|
||
|
|
||
|
iget-object v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->audioManager:Landroid/media/AudioManager;
|
||
|
|
||
|
const-string v1, "android.media.property.OUTPUT_SAMPLE_RATE"
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroid/media/AudioManager;->getProperty(Ljava/lang/String;)Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioUtils;->getDefaultSampleRateHz()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:cond_0
|
||
|
invoke-static {v0}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
:goto_0
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method public static declared-synchronized getStereoInput()Z
|
||
|
.locals 2
|
||
|
|
||
|
const-class v0, Lorg/webrtc/voiceengine/WebRtcAudioManager;
|
||
|
|
||
|
monitor-enter v0
|
||
|
|
||
|
:try_start_0
|
||
|
sget-boolean v1, Lorg/webrtc/voiceengine/WebRtcAudioManager;->useStereoInput:Z
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
monitor-exit v0
|
||
|
|
||
|
return v1
|
||
|
|
||
|
:catchall_0
|
||
|
move-exception v1
|
||
|
|
||
|
monitor-exit v0
|
||
|
|
||
|
throw v1
|
||
|
.end method
|
||
|
|
||
|
.method public static declared-synchronized getStereoOutput()Z
|
||
|
.locals 2
|
||
|
|
||
|
const-class v0, Lorg/webrtc/voiceengine/WebRtcAudioManager;
|
||
|
|
||
|
monitor-enter v0
|
||
|
|
||
|
:try_start_0
|
||
|
sget-boolean v1, Lorg/webrtc/voiceengine/WebRtcAudioManager;->useStereoOutput:Z
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
monitor-exit v0
|
||
|
|
||
|
return v1
|
||
|
|
||
|
:catchall_0
|
||
|
move-exception v1
|
||
|
|
||
|
monitor-exit v0
|
||
|
|
||
|
throw v1
|
||
|
.end method
|
||
|
|
||
|
.method private hasEarpiece()Z
|
||
|
.locals 2
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/ContextUtils;->getApplicationContext()Landroid/content/Context;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v1, "android.hardware.telephony"
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroid/content/pm/PackageManager;->hasSystemFeature(Ljava/lang/String;)Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method private init()Z
|
||
|
.locals 4
|
||
|
|
||
|
const-string v0, "init"
|
||
|
|
||
|
invoke-static {v0}, Lf/e/c/a/a;->E(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioUtils;->getThreadInfo()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v1, "WebRtcAudioManager"
|
||
|
|
||
|
invoke-static {v1, v0}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V
|
||
|
|
||
|
iget-boolean v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->initialized:Z
|
||
|
|
||
|
const/4 v2, 0x1
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
return v2
|
||
|
|
||
|
:cond_0
|
||
|
const-string v0, "audio mode is: "
|
||
|
|
||
|
invoke-static {v0}, Lf/e/c/a/a;->E(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
iget-object v3, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->audioManager:Landroid/media/AudioManager;
|
||
|
|
||
|
invoke-virtual {v3}, Landroid/media/AudioManager;->getMode()I
|
||
|
|
||
|
move-result v3
|
||
|
|
||
|
invoke-static {v3}, Lorg/webrtc/voiceengine/WebRtcAudioUtils;->modeToString(I)Ljava/lang/String;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-static {v1, v0}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V
|
||
|
|
||
|
iput-boolean v2, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->initialized:Z
|
||
|
|
||
|
iget-object v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->volumeLogger:Lorg/webrtc/voiceengine/WebRtcAudioManager$VolumeLogger;
|
||
|
|
||
|
invoke-virtual {v0}, Lorg/webrtc/voiceengine/WebRtcAudioManager$VolumeLogger;->start()V
|
||
|
|
||
|
return v2
|
||
|
.end method
|
||
|
|
||
|
.method private isAAudioSupported()Z
|
||
|
.locals 2
|
||
|
|
||
|
const-string v0, "WebRtcAudioManager"
|
||
|
|
||
|
const-string v1, "AAudio support is currently disabled on all devices!"
|
||
|
|
||
|
invoke-static {v0, v1}, Lorg/webrtc/Logging;->w(Ljava/lang/String;Ljava/lang/String;)V
|
||
|
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method public static isAcousticEchoCancelerSupported()Z
|
||
|
.locals 1
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioEffects;->canUseAcousticEchoCanceler()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method private isCommunicationModeEnabled()Z
|
||
|
.locals 2
|
||
|
|
||
|
iget-object v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->audioManager:Landroid/media/AudioManager;
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/media/AudioManager;->getMode()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
const/4 v1, 0x3
|
||
|
|
||
|
if-ne v0, v1, :cond_0
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:cond_0
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
:goto_0
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method private isDeviceBlacklistedForOpenSLESUsage()Z
|
||
|
.locals 3
|
||
|
|
||
|
sget-boolean v0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->blacklistDeviceForOpenSLESUsageIsOverridden:Z
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
sget-boolean v0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->blacklistDeviceForOpenSLESUsage:Z
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:cond_0
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioUtils;->deviceIsBlacklistedForOpenSLESUsage()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
:goto_0
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
new-instance v1, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
sget-object v2, Landroid/os/Build;->MODEL:Ljava/lang/String;
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
const-string v2, " is blacklisted for OpenSL ES usage!"
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
const-string v2, "WebRtcAudioManager"
|
||
|
|
||
|
invoke-static {v2, v1}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V
|
||
|
|
||
|
:cond_1
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method private isLowLatencyOutputSupported()Z
|
||
|
.locals 2
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/ContextUtils;->getApplicationContext()Landroid/content/Context;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v1, "android.hardware.audio.low_latency"
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroid/content/pm/PackageManager;->hasSystemFeature(Ljava/lang/String;)Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method public static isNoiseSuppressorSupported()Z
|
||
|
.locals 1
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioEffects;->canUseNoiseSuppressor()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method private isProAudioSupported()Z
|
||
|
.locals 2
|
||
|
|
||
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
||
|
|
||
|
const/16 v1, 0x17
|
||
|
|
||
|
if-lt v0, v1, :cond_0
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/ContextUtils;->getApplicationContext()Landroid/content/Context;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
const-string v1, "android.hardware.audio.pro"
|
||
|
|
||
|
invoke-virtual {v0, v1}, Landroid/content/pm/PackageManager;->hasSystemFeature(Ljava/lang/String;)Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:cond_0
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
:goto_0
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method private native nativeCacheAudioParameters(IIIZZZZZZZIIJ)V
|
||
|
.end method
|
||
|
|
||
|
.method public static declared-synchronized setBlacklistDeviceForOpenSLESUsage(Z)V
|
||
|
.locals 2
|
||
|
|
||
|
const-class v0, Lorg/webrtc/voiceengine/WebRtcAudioManager;
|
||
|
|
||
|
monitor-enter v0
|
||
|
|
||
|
const/4 v1, 0x1
|
||
|
|
||
|
:try_start_0
|
||
|
sput-boolean v1, Lorg/webrtc/voiceengine/WebRtcAudioManager;->blacklistDeviceForOpenSLESUsageIsOverridden:Z
|
||
|
|
||
|
sput-boolean p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->blacklistDeviceForOpenSLESUsage:Z
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
monitor-exit v0
|
||
|
|
||
|
return-void
|
||
|
|
||
|
:catchall_0
|
||
|
move-exception p0
|
||
|
|
||
|
monitor-exit v0
|
||
|
|
||
|
throw p0
|
||
|
.end method
|
||
|
|
||
|
.method public static declared-synchronized setStereoInput(Z)V
|
||
|
.locals 4
|
||
|
|
||
|
const-class v0, Lorg/webrtc/voiceengine/WebRtcAudioManager;
|
||
|
|
||
|
monitor-enter v0
|
||
|
|
||
|
:try_start_0
|
||
|
const-string v1, "WebRtcAudioManager"
|
||
|
|
||
|
new-instance v2, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v3, "Overriding default input behavior: setStereoInput("
|
||
|
|
||
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v2, p0}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;
|
||
|
|
||
|
const/16 v3, 0x29
|
||
|
|
||
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-static {v1, v2}, Lorg/webrtc/Logging;->w(Ljava/lang/String;Ljava/lang/String;)V
|
||
|
|
||
|
sput-boolean p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->useStereoInput:Z
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
monitor-exit v0
|
||
|
|
||
|
return-void
|
||
|
|
||
|
:catchall_0
|
||
|
move-exception p0
|
||
|
|
||
|
monitor-exit v0
|
||
|
|
||
|
throw p0
|
||
|
.end method
|
||
|
|
||
|
.method public static declared-synchronized setStereoOutput(Z)V
|
||
|
.locals 4
|
||
|
|
||
|
const-class v0, Lorg/webrtc/voiceengine/WebRtcAudioManager;
|
||
|
|
||
|
monitor-enter v0
|
||
|
|
||
|
:try_start_0
|
||
|
const-string v1, "WebRtcAudioManager"
|
||
|
|
||
|
new-instance v2, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v3, "Overriding default output behavior: setStereoOutput("
|
||
|
|
||
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v2, p0}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;
|
||
|
|
||
|
const/16 v3, 0x29
|
||
|
|
||
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-static {v1, v2}, Lorg/webrtc/Logging;->w(Ljava/lang/String;Ljava/lang/String;)V
|
||
|
|
||
|
sput-boolean p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->useStereoOutput:Z
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
monitor-exit v0
|
||
|
|
||
|
return-void
|
||
|
|
||
|
:catchall_0
|
||
|
move-exception p0
|
||
|
|
||
|
monitor-exit v0
|
||
|
|
||
|
throw p0
|
||
|
.end method
|
||
|
|
||
|
.method private storeAudioParameters()V
|
||
|
.locals 3
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->getStereoOutput()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
const/4 v1, 0x2
|
||
|
|
||
|
const/4 v2, 0x1
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
const/4 v0, 0x2
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:cond_0
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
:goto_0
|
||
|
iput v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->outputChannels:I
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->getStereoInput()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
goto :goto_1
|
||
|
|
||
|
:cond_1
|
||
|
const/4 v1, 0x1
|
||
|
|
||
|
:goto_1
|
||
|
iput v1, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->inputChannels:I
|
||
|
|
||
|
invoke-direct {p0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->getNativeOutputSampleRate()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
iput v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->sampleRate:I
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->isAcousticEchoCancelerSupported()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
iput-boolean v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->hardwareAEC:Z
|
||
|
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
iput-boolean v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->hardwareAGC:Z
|
||
|
|
||
|
invoke-static {}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->isNoiseSuppressorSupported()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
iput-boolean v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->hardwareNS:Z
|
||
|
|
||
|
invoke-direct {p0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->isLowLatencyOutputSupported()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
iput-boolean v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->lowLatencyOutput:Z
|
||
|
|
||
|
invoke-virtual {p0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->isLowLatencyInputSupported()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
iput-boolean v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->lowLatencyInput:Z
|
||
|
|
||
|
invoke-direct {p0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->isProAudioSupported()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
iput-boolean v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->proAudio:Z
|
||
|
|
||
|
invoke-direct {p0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->isAAudioSupported()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
iput-boolean v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->aAudio:Z
|
||
|
|
||
|
iget-boolean v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->lowLatencyOutput:Z
|
||
|
|
||
|
if-eqz v0, :cond_2
|
||
|
|
||
|
invoke-direct {p0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->getLowLatencyOutputFramesPerBuffer()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
goto :goto_2
|
||
|
|
||
|
:cond_2
|
||
|
iget v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->sampleRate:I
|
||
|
|
||
|
iget v1, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->outputChannels:I
|
||
|
|
||
|
invoke-static {v0, v1}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->getMinOutputFrameSize(II)I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
:goto_2
|
||
|
iput v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->outputBufferSize:I
|
||
|
|
||
|
iget-boolean v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->lowLatencyInput:Z
|
||
|
|
||
|
if-eqz v0, :cond_3
|
||
|
|
||
|
invoke-direct {p0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->getLowLatencyInputFramesPerBuffer()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
goto :goto_3
|
||
|
|
||
|
:cond_3
|
||
|
iget v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->sampleRate:I
|
||
|
|
||
|
iget v1, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->inputChannels:I
|
||
|
|
||
|
invoke-static {v0, v1}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->getMinInputFrameSize(II)I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
:goto_3
|
||
|
iput v0, p0, Lorg/webrtc/voiceengine/WebRtcAudioManager;->inputBufferSize:I
|
||
|
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
|
||
|
# virtual methods
|
||
|
.method public isLowLatencyInputSupported()Z
|
||
|
.locals 1
|
||
|
|
||
|
invoke-direct {p0}, Lorg/webrtc/voiceengine/WebRtcAudioManager;->isLowLatencyOutputSupported()Z
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:cond_0
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
:goto_0
|
||
|
return v0
|
||
|
.end method
|