You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1943 lines
44 KiB
1943 lines
44 KiB
2 years ago
|
.class public Lcom/viatech/VrPlayer/AudioPlayer;
|
||
|
.super Ljava/lang/Object;
|
||
|
.source "AudioPlayer.java"
|
||
|
|
||
|
|
||
|
# annotations
|
||
|
.annotation system Ldalvik/annotation/MemberClasses;
|
||
|
value = {
|
||
|
Lcom/viatech/VrPlayer/AudioPlayer$AudioHandler;
|
||
|
}
|
||
|
.end annotation
|
||
|
|
||
|
|
||
|
# static fields
|
||
|
.field static final AAC_CODEC_ID:I = 0x15002
|
||
|
|
||
|
.field static final MP3_CODEC_ID:I = 0x15001
|
||
|
|
||
|
.field private static final MSG_AUDIO_DECODER_DECODE:I = 0x2710
|
||
|
|
||
|
.field static final PCM_S16LE_ID:I = 0x10000
|
||
|
|
||
|
|
||
|
# instance fields
|
||
|
.field private final AUDIO_MAX_BUFFER_TIME:I
|
||
|
|
||
|
.field private final AUDIO_MIN_BUFFER_TIME:I
|
||
|
|
||
|
.field private TAG:Ljava/lang/String;
|
||
|
|
||
|
.field private mAudioFlush:I
|
||
|
|
||
|
.field private mAudioHandler:Lcom/viatech/VrPlayer/AudioPlayer$AudioHandler;
|
||
|
|
||
|
.field private mAudioTrack:Landroid/media/AudioTrack;
|
||
|
|
||
|
.field private mAudioUpdateTime:J
|
||
|
|
||
|
.field private mBitDepth:I
|
||
|
|
||
|
.field private mChannel:I
|
||
|
|
||
|
.field private mCodecId:I
|
||
|
|
||
|
.field private mCodecInited:I
|
||
|
|
||
|
.field private mCodecInputBuffers:[Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.field private mCodecOutputBuffers:[Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.field private mCurrentMediaPosition:I
|
||
|
|
||
|
.field private mCurrentPosition:I
|
||
|
|
||
|
.field private mDataList:Ljava/util/List;
|
||
|
.annotation system Ldalvik/annotation/Signature;
|
||
|
value = {
|
||
|
"Ljava/util/List",
|
||
|
"<",
|
||
|
"Lcom/viatech/VrPlayer/MediaPacket;",
|
||
|
">;"
|
||
|
}
|
||
|
.end annotation
|
||
|
.end field
|
||
|
|
||
|
.field private mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
.field private mMimeString:Ljava/lang/String;
|
||
|
|
||
|
.field private mObject:Ljava/lang/Object;
|
||
|
|
||
|
.field private mPaused:I
|
||
|
|
||
|
.field private mSampleRate:I
|
||
|
|
||
|
.field private mStartPlaybackPosition:I
|
||
|
|
||
|
.field private mWaitBuffer:I
|
||
|
|
||
|
.field private mWorkThread:Landroid/os/HandlerThread;
|
||
|
|
||
|
|
||
|
# direct methods
|
||
|
.method public constructor <init>()V
|
||
|
.locals 5
|
||
|
|
||
|
.prologue
|
||
|
const/4 v4, 0x2
|
||
|
|
||
|
const/4 v3, 0x0
|
||
|
|
||
|
const/4 v2, -0x1
|
||
|
|
||
|
const/4 v1, 0x0
|
||
|
|
||
|
.line 53
|
||
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||
|
|
||
|
.line 24
|
||
|
const/16 v0, 0x1f4
|
||
|
|
||
|
iput v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->AUDIO_MAX_BUFFER_TIME:I
|
||
|
|
||
|
.line 25
|
||
|
const/16 v0, 0x3e8
|
||
|
|
||
|
iput v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->AUDIO_MIN_BUFFER_TIME:I
|
||
|
|
||
|
.line 26
|
||
|
const-string v0, "Vpai_AudioPlayer"
|
||
|
|
||
|
iput-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->TAG:Ljava/lang/String;
|
||
|
|
||
|
.line 27
|
||
|
const-string v0, "audio/mp4a-latm"
|
||
|
|
||
|
iput-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMimeString:Ljava/lang/String;
|
||
|
|
||
|
.line 28
|
||
|
iput-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
.line 29
|
||
|
iput-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioTrack:Landroid/media/AudioTrack;
|
||
|
|
||
|
.line 30
|
||
|
iput-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mWorkThread:Landroid/os/HandlerThread;
|
||
|
|
||
|
.line 31
|
||
|
iput-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioHandler:Lcom/viatech/VrPlayer/AudioPlayer$AudioHandler;
|
||
|
|
||
|
.line 32
|
||
|
iput-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecInputBuffers:[Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.line 33
|
||
|
iput-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecOutputBuffers:[Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.line 35
|
||
|
iput v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCurrentPosition:I
|
||
|
|
||
|
.line 36
|
||
|
iput v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCurrentMediaPosition:I
|
||
|
|
||
|
.line 37
|
||
|
const-wide/16 v0, -0x1
|
||
|
|
||
|
iput-wide v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioUpdateTime:J
|
||
|
|
||
|
.line 40
|
||
|
iput v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mStartPlaybackPosition:I
|
||
|
|
||
|
.line 41
|
||
|
new-instance v0, Ljava/lang/Object;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
|
||
|
|
||
|
iput-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
.line 43
|
||
|
const v0, 0x15002
|
||
|
|
||
|
iput v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecId:I
|
||
|
|
||
|
.line 44
|
||
|
const/16 v0, 0x3e80
|
||
|
|
||
|
iput v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mSampleRate:I
|
||
|
|
||
|
.line 45
|
||
|
iput v4, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mChannel:I
|
||
|
|
||
|
.line 46
|
||
|
iput v4, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mBitDepth:I
|
||
|
|
||
|
.line 47
|
||
|
iput v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecInited:I
|
||
|
|
||
|
.line 48
|
||
|
new-instance v0, Ljava/util/ArrayList;
|
||
|
|
||
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
||
|
|
||
|
iput-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mDataList:Ljava/util/List;
|
||
|
|
||
|
.line 49
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
iput v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mWaitBuffer:I
|
||
|
|
||
|
.line 50
|
||
|
iput v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mPaused:I
|
||
|
|
||
|
.line 51
|
||
|
iput v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioFlush:I
|
||
|
|
||
|
.line 54
|
||
|
new-instance v0, Landroid/os/HandlerThread;
|
||
|
|
||
|
const-string v1, "AudioPlayer"
|
||
|
|
||
|
invoke-direct {v0, v1}, Landroid/os/HandlerThread;-><init>(Ljava/lang/String;)V
|
||
|
|
||
|
iput-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mWorkThread:Landroid/os/HandlerThread;
|
||
|
|
||
|
.line 55
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mWorkThread:Landroid/os/HandlerThread;
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/os/HandlerThread;->start()V
|
||
|
|
||
|
.line 56
|
||
|
new-instance v0, Lcom/viatech/VrPlayer/AudioPlayer$AudioHandler;
|
||
|
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mWorkThread:Landroid/os/HandlerThread;
|
||
|
|
||
|
invoke-virtual {v1}, Landroid/os/HandlerThread;->getLooper()Landroid/os/Looper;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-direct {v0, p0, v1}, Lcom/viatech/VrPlayer/AudioPlayer$AudioHandler;-><init>(Lcom/viatech/VrPlayer/AudioPlayer;Landroid/os/Looper;)V
|
||
|
|
||
|
iput-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioHandler:Lcom/viatech/VrPlayer/AudioPlayer$AudioHandler;
|
||
|
|
||
|
.line 57
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method static synthetic access$000(Lcom/viatech/VrPlayer/AudioPlayer;)Ljava/lang/Object;
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 19
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
.method static synthetic access$100(Lcom/viatech/VrPlayer/AudioPlayer;)I
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 19
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mPaused:I
|
||
|
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method static synthetic access$200(Lcom/viatech/VrPlayer/AudioPlayer;)Ljava/util/List;
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 19
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mDataList:Ljava/util/List;
|
||
|
|
||
|
return-object v0
|
||
|
.end method
|
||
|
|
||
|
.method static synthetic access$302(Lcom/viatech/VrPlayer/AudioPlayer;I)I
|
||
|
.locals 0
|
||
|
|
||
|
.prologue
|
||
|
.line 19
|
||
|
iput p1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mWaitBuffer:I
|
||
|
|
||
|
return p1
|
||
|
.end method
|
||
|
|
||
|
.method static synthetic access$402(Lcom/viatech/VrPlayer/AudioPlayer;I)I
|
||
|
.locals 0
|
||
|
|
||
|
.prologue
|
||
|
.line 19
|
||
|
iput p1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCurrentMediaPosition:I
|
||
|
|
||
|
return p1
|
||
|
.end method
|
||
|
|
||
|
.method static synthetic access$502(Lcom/viatech/VrPlayer/AudioPlayer;J)J
|
||
|
.locals 1
|
||
|
|
||
|
.prologue
|
||
|
.line 19
|
||
|
iput-wide p1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioUpdateTime:J
|
||
|
|
||
|
return-wide p1
|
||
|
.end method
|
||
|
|
||
|
.method private initDecode([B)I
|
||
|
.locals 10
|
||
|
|
||
|
.prologue
|
||
|
const/4 v5, 0x2
|
||
|
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
const/4 v9, 0x1
|
||
|
|
||
|
const/4 v1, 0x0
|
||
|
|
||
|
const/4 v0, -0x1
|
||
|
|
||
|
.line 303
|
||
|
.line 305
|
||
|
iget v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecId:I
|
||
|
|
||
|
const v4, 0x15002
|
||
|
|
||
|
if-ne v3, v4, :cond_3
|
||
|
|
||
|
.line 306
|
||
|
aget-byte v2, p1, v1
|
||
|
|
||
|
if-ne v2, v0, :cond_0
|
||
|
|
||
|
aget-byte v2, p1, v9
|
||
|
|
||
|
const/16 v3, -0xf
|
||
|
|
||
|
if-eq v2, v3, :cond_1
|
||
|
|
||
|
.line 307
|
||
|
:cond_0
|
||
|
iget-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->TAG:Ljava/lang/String;
|
||
|
|
||
|
new-instance v3, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v4, "Only Support ADTS AAC now "
|
||
|
|
||
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
aget-byte v1, p1, v1
|
||
|
|
||
|
invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
const-string v3, " "
|
||
|
|
||
|
invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
aget-byte v3, p1, v9
|
||
|
|
||
|
invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-static {v2, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
|
||
|
|
||
|
.line 360
|
||
|
:goto_0
|
||
|
return v0
|
||
|
|
||
|
.line 310
|
||
|
:cond_1
|
||
|
const-string v2, "audio/mp4a-latm"
|
||
|
|
||
|
iput-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMimeString:Ljava/lang/String;
|
||
|
|
||
|
.line 311
|
||
|
new-array v2, v5, [B
|
||
|
|
||
|
.line 312
|
||
|
aget-byte v3, p1, v5
|
||
|
|
||
|
.line 313
|
||
|
const/4 v4, 0x3
|
||
|
|
||
|
aget-byte v4, p1, v4
|
||
|
|
||
|
.line 315
|
||
|
shr-int/lit8 v5, v3, 0x2
|
||
|
|
||
|
and-int/lit8 v5, v5, 0xf
|
||
|
|
||
|
.line 316
|
||
|
shr-int/lit8 v6, v3, 0x6
|
||
|
|
||
|
and-int/lit8 v6, v6, 0x3
|
||
|
|
||
|
.line 317
|
||
|
and-int/lit8 v3, v3, 0x1
|
||
|
|
||
|
shl-int/lit8 v3, v3, 0x2
|
||
|
|
||
|
shr-int/lit8 v4, v4, 0x6
|
||
|
|
||
|
and-int/lit8 v4, v4, 0x3
|
||
|
|
||
|
or-int/2addr v3, v4
|
||
|
|
||
|
.line 319
|
||
|
const/16 v4, 0xd
|
||
|
|
||
|
new-array v4, v4, [I
|
||
|
|
||
|
fill-array-data v4, :array_0
|
||
|
|
||
|
.line 320
|
||
|
const/4 v7, 0x3
|
||
|
|
||
|
new-array v7, v7, [I
|
||
|
|
||
|
fill-array-data v7, :array_1
|
||
|
|
||
|
.line 322
|
||
|
add-int/lit8 v6, v6, 0x1
|
||
|
|
||
|
and-int/lit8 v6, v6, 0x1f
|
||
|
|
||
|
shl-int/lit8 v6, v6, 0x3
|
||
|
|
||
|
shr-int/lit8 v8, v5, 0x1
|
||
|
|
||
|
and-int/lit8 v8, v8, 0x7
|
||
|
|
||
|
add-int/2addr v6, v8
|
||
|
|
||
|
int-to-byte v6, v6
|
||
|
|
||
|
aput-byte v6, v2, v1
|
||
|
|
||
|
.line 323
|
||
|
and-int/lit8 v6, v5, 0x1
|
||
|
|
||
|
shl-int/lit8 v6, v6, 0x7
|
||
|
|
||
|
and-int/lit8 v8, v3, 0xf
|
||
|
|
||
|
shl-int/lit8 v8, v8, 0x3
|
||
|
|
||
|
add-int/2addr v6, v8
|
||
|
|
||
|
int-to-byte v6, v6
|
||
|
|
||
|
aput-byte v6, v2, v9
|
||
|
|
||
|
.line 325
|
||
|
aget v4, v4, v5
|
||
|
|
||
|
iput v4, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mSampleRate:I
|
||
|
|
||
|
.line 326
|
||
|
aget v3, v7, v3
|
||
|
|
||
|
iput v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mChannel:I
|
||
|
|
||
|
.line 338
|
||
|
:goto_1
|
||
|
:try_start_0
|
||
|
iget-object v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMimeString:Ljava/lang/String;
|
||
|
|
||
|
invoke-static {v3}, Landroid/media/MediaCodec;->createDecoderByType(Ljava/lang/String;)Landroid/media/MediaCodec;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
iput-object v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
:try_end_0
|
||
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
||
|
|
||
|
.line 344
|
||
|
iget-object v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->TAG:Ljava/lang/String;
|
||
|
|
||
|
new-instance v4, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v5, "mSampleRate = "
|
||
|
|
||
|
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v4
|
||
|
|
||
|
iget v5, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mSampleRate:I
|
||
|
|
||
|
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v4
|
||
|
|
||
|
const-string v5, " mChanel = "
|
||
|
|
||
|
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v4
|
||
|
|
||
|
iget v5, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mChannel:I
|
||
|
|
||
|
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v4
|
||
|
|
||
|
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v4
|
||
|
|
||
|
invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
||
|
|
||
|
.line 345
|
||
|
iget-object v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMimeString:Ljava/lang/String;
|
||
|
|
||
|
iget v4, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mSampleRate:I
|
||
|
|
||
|
iget v5, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mChannel:I
|
||
|
|
||
|
invoke-static {v3, v4, v5}, Landroid/media/MediaFormat;->createAudioFormat(Ljava/lang/String;II)Landroid/media/MediaFormat;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
.line 346
|
||
|
if-eqz v2, :cond_2
|
||
|
|
||
|
.line 347
|
||
|
const-string v4, "csd-0"
|
||
|
|
||
|
invoke-static {v2}, Ljava/nio/ByteBuffer;->wrap([B)Ljava/nio/ByteBuffer;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {v3, v4, v2}, Landroid/media/MediaFormat;->setByteBuffer(Ljava/lang/String;Ljava/nio/ByteBuffer;)V
|
||
|
|
||
|
.line 351
|
||
|
:cond_2
|
||
|
:try_start_1
|
||
|
iget-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
const/4 v4, 0x0
|
||
|
|
||
|
const/4 v5, 0x0
|
||
|
|
||
|
const/4 v6, 0x0
|
||
|
|
||
|
invoke-virtual {v2, v3, v4, v5, v6}, Landroid/media/MediaCodec;->configure(Landroid/media/MediaFormat;Landroid/view/Surface;Landroid/media/MediaCrypto;I)V
|
||
|
|
||
|
.line 352
|
||
|
iget-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
invoke-virtual {v2}, Landroid/media/MediaCodec;->start()V
|
||
|
|
||
|
.line 353
|
||
|
iget-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
invoke-virtual {v2}, Landroid/media/MediaCodec;->getInputBuffers()[Ljava/nio/ByteBuffer;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
iput-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecInputBuffers:[Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.line 354
|
||
|
iget-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
invoke-virtual {v2}, Landroid/media/MediaCodec;->getOutputBuffers()[Ljava/nio/ByteBuffer;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
iput-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecOutputBuffers:[Ljava/nio/ByteBuffer;
|
||
|
:try_end_1
|
||
|
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1
|
||
|
|
||
|
move v0, v1
|
||
|
|
||
|
.line 360
|
||
|
goto/16 :goto_0
|
||
|
|
||
|
.line 328
|
||
|
:cond_3
|
||
|
iget v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecId:I
|
||
|
|
||
|
const v4, 0x15001
|
||
|
|
||
|
if-ne v3, v4, :cond_4
|
||
|
|
||
|
.line 329
|
||
|
const-string v3, "audio/mpeg"
|
||
|
|
||
|
iput-object v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMimeString:Ljava/lang/String;
|
||
|
|
||
|
goto :goto_1
|
||
|
|
||
|
.line 330
|
||
|
:cond_4
|
||
|
iget v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecId:I
|
||
|
|
||
|
const/high16 v4, 0x10000
|
||
|
|
||
|
if-ne v3, v4, :cond_5
|
||
|
|
||
|
.line 331
|
||
|
const-string v3, "audio/raw"
|
||
|
|
||
|
iput-object v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMimeString:Ljava/lang/String;
|
||
|
|
||
|
goto :goto_1
|
||
|
|
||
|
.line 333
|
||
|
:cond_5
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->TAG:Ljava/lang/String;
|
||
|
|
||
|
new-instance v2, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v3, "Audio Codec ID Error = "
|
||
|
|
||
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
iget v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecId:I
|
||
|
|
||
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
|
||
|
|
||
|
goto/16 :goto_0
|
||
|
|
||
|
.line 339
|
||
|
:catch_0
|
||
|
move-exception v1
|
||
|
|
||
|
.line 340
|
||
|
iget-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->TAG:Ljava/lang/String;
|
||
|
|
||
|
new-instance v3, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v4, "createDecoderByType:"
|
||
|
|
||
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
iget-object v4, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMimeString:Ljava/lang/String;
|
||
|
|
||
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
const-string v4, " Failed"
|
||
|
|
||
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
invoke-static {v2, v3, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
|
||
|
|
||
|
goto/16 :goto_0
|
||
|
|
||
|
.line 355
|
||
|
:catch_1
|
||
|
move-exception v1
|
||
|
|
||
|
.line 356
|
||
|
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
|
||
|
|
||
|
goto/16 :goto_0
|
||
|
|
||
|
.line 319
|
||
|
nop
|
||
|
|
||
|
:array_0
|
||
|
.array-data 4
|
||
|
0x17700
|
||
|
0x15888
|
||
|
0xfa00
|
||
|
0xbb80
|
||
|
0xac44
|
||
|
0x7d00
|
||
|
0x5dc0
|
||
|
0x5622
|
||
|
0x3e80
|
||
|
0x2ee0
|
||
|
0x2b11
|
||
|
0x1f40
|
||
|
0x1cb6
|
||
|
.end array-data
|
||
|
|
||
|
.line 320
|
||
|
:array_1
|
||
|
.array-data 4
|
||
|
0x0
|
||
|
0x1
|
||
|
0x2
|
||
|
.end array-data
|
||
|
.end method
|
||
|
|
||
|
|
||
|
# virtual methods
|
||
|
.method public addAudioConfig([B)V
|
||
|
.locals 8
|
||
|
|
||
|
.prologue
|
||
|
const/4 v7, 0x1
|
||
|
|
||
|
const/4 v6, -0x1
|
||
|
|
||
|
const/4 v1, 0x0
|
||
|
|
||
|
.line 222
|
||
|
new-instance v0, Ljava/lang/String;
|
||
|
|
||
|
invoke-direct {v0, p1}, Ljava/lang/String;-><init>([B)V
|
||
|
|
||
|
.line 223
|
||
|
const-string v2, ","
|
||
|
|
||
|
invoke-virtual {v0, v2}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
move v0, v1
|
||
|
|
||
|
.line 226
|
||
|
:goto_0
|
||
|
array-length v3, v2
|
||
|
|
||
|
if-ge v0, v3, :cond_4
|
||
|
|
||
|
.line 227
|
||
|
aget-object v3, v2, v0
|
||
|
|
||
|
const-string v4, ":"
|
||
|
|
||
|
invoke-virtual {v3, v4}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;
|
||
|
|
||
|
move-result-object v3
|
||
|
|
||
|
.line 229
|
||
|
aget-object v4, v3, v1
|
||
|
|
||
|
const-string v5, "codec_id"
|
||
|
|
||
|
invoke-virtual {v4, v5}, Ljava/lang/String;->indexOf(Ljava/lang/String;)I
|
||
|
|
||
|
move-result v4
|
||
|
|
||
|
if-eq v4, v6, :cond_0
|
||
|
|
||
|
.line 230
|
||
|
aget-object v4, v3, v7
|
||
|
|
||
|
invoke-static {v4}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
|
||
|
|
||
|
move-result v4
|
||
|
|
||
|
iput v4, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecId:I
|
||
|
|
||
|
.line 232
|
||
|
:cond_0
|
||
|
aget-object v4, v3, v1
|
||
|
|
||
|
const-string v5, "samplerate"
|
||
|
|
||
|
invoke-virtual {v4, v5}, Ljava/lang/String;->indexOf(Ljava/lang/String;)I
|
||
|
|
||
|
move-result v4
|
||
|
|
||
|
if-eq v4, v6, :cond_1
|
||
|
|
||
|
.line 233
|
||
|
aget-object v4, v3, v7
|
||
|
|
||
|
invoke-static {v4}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
|
||
|
|
||
|
move-result v4
|
||
|
|
||
|
iput v4, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mSampleRate:I
|
||
|
|
||
|
.line 235
|
||
|
:cond_1
|
||
|
aget-object v4, v3, v1
|
||
|
|
||
|
const-string v5, "channel"
|
||
|
|
||
|
invoke-virtual {v4, v5}, Ljava/lang/String;->indexOf(Ljava/lang/String;)I
|
||
|
|
||
|
move-result v4
|
||
|
|
||
|
if-eq v4, v6, :cond_2
|
||
|
|
||
|
.line 236
|
||
|
aget-object v4, v3, v7
|
||
|
|
||
|
invoke-static {v4}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
|
||
|
|
||
|
move-result v4
|
||
|
|
||
|
iput v4, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mChannel:I
|
||
|
|
||
|
.line 237
|
||
|
iget v4, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mChannel:I
|
||
|
|
||
|
if-ne v4, v7, :cond_2
|
||
|
|
||
|
.line 243
|
||
|
:cond_2
|
||
|
aget-object v3, v3, v1
|
||
|
|
||
|
const-string v4, "bit"
|
||
|
|
||
|
invoke-virtual {v3, v4}, Ljava/lang/String;->indexOf(Ljava/lang/String;)I
|
||
|
|
||
|
move-result v3
|
||
|
|
||
|
if-eq v3, v6, :cond_3
|
||
|
|
||
|
.line 226
|
||
|
:cond_3
|
||
|
add-int/lit8 v0, v0, 0x1
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 249
|
||
|
:cond_4
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->TAG:Ljava/lang/String;
|
||
|
|
||
|
new-instance v1, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v2, "Create Audio Track mSampleRate = "
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
iget v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mSampleRate:I
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
const-string v2, " mChannel = "
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
iget v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mChannel:I
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
const-string v2, " bit = "
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
iget v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mBitDepth:I
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
||
|
|
||
|
.line 251
|
||
|
return-void
|
||
|
.end method
|
||
|
|
||
|
.method public addAudioPacket([BI)V
|
||
|
.locals 5
|
||
|
|
||
|
.prologue
|
||
|
const/4 v4, 0x1
|
||
|
|
||
|
const/4 v3, -0x1
|
||
|
|
||
|
.line 266
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecInited:I
|
||
|
|
||
|
if-nez v0, :cond_1
|
||
|
|
||
|
.line 269
|
||
|
invoke-direct {p0, p1}, Lcom/viatech/VrPlayer/AudioPlayer;->initDecode([B)I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
if-ne v0, v3, :cond_0
|
||
|
|
||
|
.line 300
|
||
|
:goto_0
|
||
|
return-void
|
||
|
|
||
|
.line 271
|
||
|
:cond_0
|
||
|
iput v4, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecInited:I
|
||
|
|
||
|
.line 274
|
||
|
:cond_1
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
monitor-enter v1
|
||
|
|
||
|
.line 275
|
||
|
:try_start_0
|
||
|
new-instance v0, Lcom/viatech/VrPlayer/MediaPacket;
|
||
|
|
||
|
invoke-direct {v0, p1, p2}, Lcom/viatech/VrPlayer/MediaPacket;-><init>([BI)V
|
||
|
|
||
|
.line 276
|
||
|
iget v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mStartPlaybackPosition:I
|
||
|
|
||
|
if-ne v2, v3, :cond_2
|
||
|
|
||
|
.line 277
|
||
|
iput p2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mStartPlaybackPosition:I
|
||
|
|
||
|
.line 279
|
||
|
:cond_2
|
||
|
iget-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mDataList:Ljava/util/List;
|
||
|
|
||
|
invoke-interface {v2, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
||
|
|
||
|
.line 280
|
||
|
monitor-exit v1
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_1
|
||
|
|
||
|
.line 283
|
||
|
invoke-virtual {p0}, Lcom/viatech/VrPlayer/AudioPlayer;->getBufferDuration()I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
const/16 v1, 0x1f4
|
||
|
|
||
|
if-le v0, v1, :cond_3
|
||
|
|
||
|
.line 284
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->TAG:Ljava/lang/String;
|
||
|
|
||
|
const-string v1, "Drop Audio Packet"
|
||
|
|
||
|
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
||
|
|
||
|
.line 285
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
monitor-enter v1
|
||
|
|
||
|
.line 286
|
||
|
:try_start_1
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mDataList:Ljava/util/List;
|
||
|
|
||
|
invoke-interface {v0}, Ljava/util/List;->clear()V
|
||
|
|
||
|
.line 287
|
||
|
monitor-exit v1
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:catchall_0
|
||
|
move-exception v0
|
||
|
|
||
|
monitor-exit v1
|
||
|
:try_end_1
|
||
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 280
|
||
|
:catchall_1
|
||
|
move-exception v0
|
||
|
|
||
|
:try_start_2
|
||
|
monitor-exit v1
|
||
|
:try_end_2
|
||
|
.catchall {:try_start_2 .. :try_end_2} :catchall_1
|
||
|
|
||
|
throw v0
|
||
|
|
||
|
.line 292
|
||
|
:cond_3
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
monitor-enter v1
|
||
|
|
||
|
.line 293
|
||
|
:try_start_3
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mWaitBuffer:I
|
||
|
|
||
|
if-ne v0, v4, :cond_4
|
||
|
|
||
|
.line 295
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
iput v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mWaitBuffer:I
|
||
|
|
||
|
.line 296
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/Object;->notify()V
|
||
|
|
||
|
.line 299
|
||
|
:cond_4
|
||
|
monitor-exit v1
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
:catchall_2
|
||
|
move-exception v0
|
||
|
|
||
|
monitor-exit v1
|
||
|
:try_end_3
|
||
|
.catchall {:try_start_3 .. :try_end_3} :catchall_2
|
||
|
|
||
|
throw v0
|
||
|
.end method
|
||
|
|
||
|
.method public decodeAndOutput([B)V
|
||
|
.locals 7
|
||
|
|
||
|
.prologue
|
||
|
const/4 v3, 0x1
|
||
|
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
.line 167
|
||
|
:try_start_0
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
monitor-enter v1
|
||
|
:try_end_0
|
||
|
.catch Ljava/lang/IllegalStateException; {:try_start_0 .. :try_end_0} :catch_0
|
||
|
.catch Ljava/lang/ArrayIndexOutOfBoundsException; {:try_start_0 .. :try_end_0} :catch_1
|
||
|
.catch Ljava/nio/BufferOverflowException; {:try_start_0 .. :try_end_0} :catch_2
|
||
|
|
||
|
.line 168
|
||
|
:try_start_1
|
||
|
iget v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioFlush:I
|
||
|
|
||
|
if-ne v2, v3, :cond_0
|
||
|
|
||
|
.line 169
|
||
|
iget-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
invoke-virtual {v2}, Landroid/media/MediaCodec;->flush()V
|
||
|
|
||
|
.line 170
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
iput v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioFlush:I
|
||
|
|
||
|
.line 172
|
||
|
:cond_0
|
||
|
monitor-exit v1
|
||
|
:try_end_1
|
||
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
||
|
|
||
|
.line 174
|
||
|
:try_start_2
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
const-wide/16 v2, -0x1
|
||
|
|
||
|
invoke-virtual {v1, v2, v3}, Landroid/media/MediaCodec;->dequeueInputBuffer(J)I
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
.line 175
|
||
|
if-gez v1, :cond_2
|
||
|
|
||
|
.line 176
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->TAG:Ljava/lang/String;
|
||
|
|
||
|
const-string v1, "failed to dequeueInputBuffer buffer"
|
||
|
|
||
|
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
||
|
:try_end_2
|
||
|
.catch Ljava/lang/IllegalStateException; {:try_start_2 .. :try_end_2} :catch_0
|
||
|
.catch Ljava/lang/ArrayIndexOutOfBoundsException; {:try_start_2 .. :try_end_2} :catch_1
|
||
|
.catch Ljava/nio/BufferOverflowException; {:try_start_2 .. :try_end_2} :catch_2
|
||
|
|
||
|
.line 218
|
||
|
:cond_1
|
||
|
:goto_0
|
||
|
return-void
|
||
|
|
||
|
.line 172
|
||
|
:catchall_0
|
||
|
move-exception v0
|
||
|
|
||
|
:try_start_3
|
||
|
monitor-exit v1
|
||
|
:try_end_3
|
||
|
.catchall {:try_start_3 .. :try_end_3} :catchall_0
|
||
|
|
||
|
:try_start_4
|
||
|
throw v0
|
||
|
:try_end_4
|
||
|
.catch Ljava/lang/IllegalStateException; {:try_start_4 .. :try_end_4} :catch_0
|
||
|
.catch Ljava/lang/ArrayIndexOutOfBoundsException; {:try_start_4 .. :try_end_4} :catch_1
|
||
|
.catch Ljava/nio/BufferOverflowException; {:try_start_4 .. :try_end_4} :catch_2
|
||
|
|
||
|
.line 211
|
||
|
:catch_0
|
||
|
move-exception v0
|
||
|
|
||
|
.line 212
|
||
|
invoke-virtual {v0}, Ljava/lang/IllegalStateException;->printStackTrace()V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 181
|
||
|
:cond_2
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
:try_start_5
|
||
|
aget-byte v2, p1, v2
|
||
|
|
||
|
const/4 v3, -0x1
|
||
|
|
||
|
if-ne v2, v3, :cond_6
|
||
|
|
||
|
const/4 v2, 0x1
|
||
|
|
||
|
aget-byte v2, p1, v2
|
||
|
|
||
|
const/16 v3, -0xf
|
||
|
|
||
|
if-ne v2, v3, :cond_6
|
||
|
|
||
|
.line 182
|
||
|
const/4 v0, 0x7
|
||
|
|
||
|
move v3, v0
|
||
|
|
||
|
.line 184
|
||
|
:goto_1
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecInputBuffers:[Ljava/nio/ByteBuffer;
|
||
|
|
||
|
aget-object v0, v0, v1
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->rewind()Ljava/nio/Buffer;
|
||
|
|
||
|
.line 185
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecInputBuffers:[Ljava/nio/ByteBuffer;
|
||
|
|
||
|
aget-object v0, v0, v1
|
||
|
|
||
|
array-length v2, p1
|
||
|
|
||
|
sub-int/2addr v2, v3
|
||
|
|
||
|
invoke-virtual {v0, p1, v3, v2}, Ljava/nio/ByteBuffer;->put([BII)Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.line 186
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
array-length v4, p1
|
||
|
|
||
|
sub-int v3, v4, v3
|
||
|
|
||
|
const-wide/16 v4, 0x0
|
||
|
|
||
|
const/4 v6, 0x0
|
||
|
|
||
|
invoke-virtual/range {v0 .. v6}, Landroid/media/MediaCodec;->queueInputBuffer(IIIJI)V
|
||
|
|
||
|
.line 194
|
||
|
new-instance v0, Landroid/media/MediaCodec$BufferInfo;
|
||
|
|
||
|
invoke-direct {v0}, Landroid/media/MediaCodec$BufferInfo;-><init>()V
|
||
|
|
||
|
.line 195
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
const-wide/16 v2, 0x1388
|
||
|
|
||
|
invoke-virtual {v1, v0, v2, v3}, Landroid/media/MediaCodec;->dequeueOutputBuffer(Landroid/media/MediaCodec$BufferInfo;J)I
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
.line 196
|
||
|
if-ltz v1, :cond_4
|
||
|
|
||
|
.line 197
|
||
|
iget v0, v0, Landroid/media/MediaCodec$BufferInfo;->size:I
|
||
|
|
||
|
new-array v0, v0, [B
|
||
|
|
||
|
.line 198
|
||
|
iget-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecOutputBuffers:[Ljava/nio/ByteBuffer;
|
||
|
|
||
|
aget-object v2, v2, v1
|
||
|
|
||
|
invoke-virtual {v2, v0}, Ljava/nio/ByteBuffer;->get([B)Ljava/nio/ByteBuffer;
|
||
|
|
||
|
.line 199
|
||
|
iget-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecOutputBuffers:[Ljava/nio/ByteBuffer;
|
||
|
|
||
|
aget-object v2, v2, v1
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;
|
||
|
|
||
|
.line 200
|
||
|
array-length v2, v0
|
||
|
|
||
|
if-lez v2, :cond_3
|
||
|
|
||
|
.line 201
|
||
|
iget-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioTrack:Landroid/media/AudioTrack;
|
||
|
|
||
|
const/4 v3, 0x0
|
||
|
|
||
|
array-length v4, v0
|
||
|
|
||
|
invoke-virtual {v2, v0, v3, v4}, Landroid/media/AudioTrack;->write([BII)I
|
||
|
|
||
|
.line 203
|
||
|
:cond_3
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
const/4 v2, 0x0
|
||
|
|
||
|
invoke-virtual {v0, v1, v2}, Landroid/media/MediaCodec;->releaseOutputBuffer(IZ)V
|
||
|
:try_end_5
|
||
|
.catch Ljava/lang/IllegalStateException; {:try_start_5 .. :try_end_5} :catch_0
|
||
|
.catch Ljava/lang/ArrayIndexOutOfBoundsException; {:try_start_5 .. :try_end_5} :catch_1
|
||
|
.catch Ljava/nio/BufferOverflowException; {:try_start_5 .. :try_end_5} :catch_2
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 213
|
||
|
:catch_1
|
||
|
move-exception v0
|
||
|
|
||
|
.line 214
|
||
|
invoke-virtual {v0}, Ljava/lang/ArrayIndexOutOfBoundsException;->printStackTrace()V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 204
|
||
|
:cond_4
|
||
|
const/4 v0, -0x3
|
||
|
|
||
|
if-ne v1, v0, :cond_5
|
||
|
|
||
|
.line 205
|
||
|
:try_start_6
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/media/MediaCodec;->getOutputBuffers()[Ljava/nio/ByteBuffer;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
iput-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecOutputBuffers:[Ljava/nio/ByteBuffer;
|
||
|
:try_end_6
|
||
|
.catch Ljava/lang/IllegalStateException; {:try_start_6 .. :try_end_6} :catch_0
|
||
|
.catch Ljava/lang/ArrayIndexOutOfBoundsException; {:try_start_6 .. :try_end_6} :catch_1
|
||
|
.catch Ljava/nio/BufferOverflowException; {:try_start_6 .. :try_end_6} :catch_2
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 215
|
||
|
:catch_2
|
||
|
move-exception v0
|
||
|
|
||
|
.line 216
|
||
|
invoke-virtual {v0}, Ljava/nio/BufferOverflowException;->printStackTrace()V
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 206
|
||
|
:cond_5
|
||
|
const/4 v0, -0x2
|
||
|
|
||
|
if-ne v1, v0, :cond_1
|
||
|
|
||
|
.line 207
|
||
|
:try_start_7
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/media/MediaCodec;->getOutputFormat()Landroid/media/MediaFormat;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
.line 208
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->TAG:Ljava/lang/String;
|
||
|
|
||
|
new-instance v2, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v3, "Output format has changed to "
|
||
|
|
||
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v2
|
||
|
|
||
|
invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
||
|
|
||
|
.line 209
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioTrack:Landroid/media/AudioTrack;
|
||
|
|
||
|
const-string v2, "sample-rate"
|
||
|
|
||
|
invoke-virtual {v0, v2}, Landroid/media/MediaFormat;->getInteger(Ljava/lang/String;)I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
invoke-virtual {v1, v0}, Landroid/media/AudioTrack;->setPlaybackRate(I)I
|
||
|
:try_end_7
|
||
|
.catch Ljava/lang/IllegalStateException; {:try_start_7 .. :try_end_7} :catch_0
|
||
|
.catch Ljava/lang/ArrayIndexOutOfBoundsException; {:try_start_7 .. :try_end_7} :catch_1
|
||
|
.catch Ljava/nio/BufferOverflowException; {:try_start_7 .. :try_end_7} :catch_2
|
||
|
|
||
|
goto/16 :goto_0
|
||
|
|
||
|
:cond_6
|
||
|
move v3, v0
|
||
|
|
||
|
goto/16 :goto_1
|
||
|
.end method
|
||
|
|
||
|
.method public flush()V
|
||
|
.locals 2
|
||
|
|
||
|
.prologue
|
||
|
.line 85
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
monitor-enter v1
|
||
|
|
||
|
.line 86
|
||
|
:try_start_0
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mDataList:Ljava/util/List;
|
||
|
|
||
|
invoke-interface {v0}, Ljava/util/List;->clear()V
|
||
|
|
||
|
.line 87
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/Object;->notify()V
|
||
|
|
||
|
.line 88
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
iput v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioFlush:I
|
||
|
|
||
|
.line 89
|
||
|
const/4 v0, -0x1
|
||
|
|
||
|
iput v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCurrentMediaPosition:I
|
||
|
|
||
|
.line 91
|
||
|
const/4 v0, -0x1
|
||
|
|
||
|
iput v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mStartPlaybackPosition:I
|
||
|
|
||
|
.line 92
|
||
|
monitor-exit v1
|
||
|
|
||
|
.line 93
|
||
|
return-void
|
||
|
|
||
|
.line 92
|
||
|
:catchall_0
|
||
|
move-exception v0
|
||
|
|
||
|
monitor-exit v1
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
throw v0
|
||
|
.end method
|
||
|
|
||
|
.method public getBufferDuration()I
|
||
|
.locals 4
|
||
|
|
||
|
.prologue
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
.line 254
|
||
|
iget-object v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
monitor-enter v2
|
||
|
|
||
|
.line 255
|
||
|
:try_start_0
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mDataList:Ljava/util/List;
|
||
|
|
||
|
invoke-interface {v1}, Ljava/util/List;->size()I
|
||
|
|
||
|
move-result v1
|
||
|
|
||
|
if-nez v1, :cond_0
|
||
|
|
||
|
.line 256
|
||
|
monitor-exit v2
|
||
|
|
||
|
.line 261
|
||
|
:goto_0
|
||
|
return v0
|
||
|
|
||
|
.line 259
|
||
|
:cond_0
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mDataList:Ljava/util/List;
|
||
|
|
||
|
const/4 v1, 0x0
|
||
|
|
||
|
invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v0
|
||
|
|
||
|
check-cast v0, Lcom/viatech/VrPlayer/MediaPacket;
|
||
|
|
||
|
.line 260
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mDataList:Ljava/util/List;
|
||
|
|
||
|
iget-object v3, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mDataList:Ljava/util/List;
|
||
|
|
||
|
invoke-interface {v3}, Ljava/util/List;->size()I
|
||
|
|
||
|
move-result v3
|
||
|
|
||
|
add-int/lit8 v3, v3, -0x1
|
||
|
|
||
|
invoke-interface {v1, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
check-cast v1, Lcom/viatech/VrPlayer/MediaPacket;
|
||
|
|
||
|
.line 261
|
||
|
iget v1, v1, Lcom/viatech/VrPlayer/MediaPacket;->mPTS:I
|
||
|
|
||
|
iget v0, v0, Lcom/viatech/VrPlayer/MediaPacket;->mPTS:I
|
||
|
|
||
|
sub-int v0, v1, v0
|
||
|
|
||
|
monitor-exit v2
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 262
|
||
|
:catchall_0
|
||
|
move-exception v0
|
||
|
|
||
|
monitor-exit v2
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
throw v0
|
||
|
.end method
|
||
|
|
||
|
.method getCurrentPosition()I
|
||
|
.locals 6
|
||
|
|
||
|
.prologue
|
||
|
const/4 v0, -0x1
|
||
|
|
||
|
.line 121
|
||
|
iget v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCurrentMediaPosition:I
|
||
|
|
||
|
if-ne v1, v0, :cond_0
|
||
|
|
||
|
.line 130
|
||
|
:goto_0
|
||
|
return v0
|
||
|
|
||
|
.line 125
|
||
|
:cond_0
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mPaused:I
|
||
|
|
||
|
const/4 v1, 0x1
|
||
|
|
||
|
if-ne v0, v1, :cond_1
|
||
|
|
||
|
.line 126
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCurrentPosition:I
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 129
|
||
|
:cond_1
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCurrentMediaPosition:I
|
||
|
|
||
|
int-to-long v0, v0
|
||
|
|
||
|
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
|
||
|
|
||
|
move-result-wide v2
|
||
|
|
||
|
iget-wide v4, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioUpdateTime:J
|
||
|
|
||
|
sub-long/2addr v2, v4
|
||
|
|
||
|
add-long/2addr v0, v2
|
||
|
|
||
|
long-to-int v0, v0
|
||
|
|
||
|
iput v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCurrentPosition:I
|
||
|
|
||
|
.line 130
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCurrentPosition:I
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method getPastDurationFromLastPlayback()I
|
||
|
.locals 3
|
||
|
|
||
|
.prologue
|
||
|
.line 135
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->TAG:Ljava/lang/String;
|
||
|
|
||
|
new-instance v1, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v2, "mStartPlaybackPosition = "
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
iget v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mStartPlaybackPosition:I
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
const-string v2, " mCurrentMediaPosition = "
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
iget v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCurrentMediaPosition:I
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
||
|
|
||
|
.line 136
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCurrentMediaPosition:I
|
||
|
|
||
|
iget v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mStartPlaybackPosition:I
|
||
|
|
||
|
sub-int/2addr v0, v1
|
||
|
|
||
|
return v0
|
||
|
.end method
|
||
|
|
||
|
.method public isPlaying()Z
|
||
|
.locals 2
|
||
|
|
||
|
.prologue
|
||
|
.line 114
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
monitor-enter v1
|
||
|
|
||
|
.line 115
|
||
|
:try_start_0
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mPaused:I
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
:goto_0
|
||
|
monitor-exit v1
|
||
|
|
||
|
return v0
|
||
|
|
||
|
:cond_0
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
goto :goto_0
|
||
|
|
||
|
.line 116
|
||
|
:catchall_0
|
||
|
move-exception v0
|
||
|
|
||
|
monitor-exit v1
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
throw v0
|
||
|
.end method
|
||
|
|
||
|
.method public pause()V
|
||
|
.locals 2
|
||
|
|
||
|
.prologue
|
||
|
.line 96
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
monitor-enter v1
|
||
|
|
||
|
.line 97
|
||
|
:try_start_0
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mPaused:I
|
||
|
|
||
|
if-nez v0, :cond_0
|
||
|
|
||
|
.line 98
|
||
|
const/4 v0, 0x1
|
||
|
|
||
|
iput v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mPaused:I
|
||
|
|
||
|
.line 99
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/Object;->notify()V
|
||
|
|
||
|
.line 101
|
||
|
:cond_0
|
||
|
monitor-exit v1
|
||
|
|
||
|
.line 102
|
||
|
return-void
|
||
|
|
||
|
.line 101
|
||
|
:catchall_0
|
||
|
move-exception v0
|
||
|
|
||
|
monitor-exit v1
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
throw v0
|
||
|
.end method
|
||
|
|
||
|
.method public resume()V
|
||
|
.locals 3
|
||
|
|
||
|
.prologue
|
||
|
.line 105
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
monitor-enter v1
|
||
|
|
||
|
.line 106
|
||
|
:try_start_0
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mPaused:I
|
||
|
|
||
|
const/4 v2, 0x1
|
||
|
|
||
|
if-ne v0, v2, :cond_0
|
||
|
|
||
|
.line 107
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
iput v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mPaused:I
|
||
|
|
||
|
.line 108
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/Object;->notify()V
|
||
|
|
||
|
.line 110
|
||
|
:cond_0
|
||
|
monitor-exit v1
|
||
|
|
||
|
.line 111
|
||
|
return-void
|
||
|
|
||
|
.line 110
|
||
|
:catchall_0
|
||
|
move-exception v0
|
||
|
|
||
|
monitor-exit v1
|
||
|
:try_end_0
|
||
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
||
|
|
||
|
throw v0
|
||
|
.end method
|
||
|
|
||
|
.method public start()I
|
||
|
.locals 7
|
||
|
|
||
|
.prologue
|
||
|
const/4 v6, 0x1
|
||
|
|
||
|
.line 61
|
||
|
.line 62
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mChannel:I
|
||
|
|
||
|
if-ne v0, v6, :cond_1
|
||
|
|
||
|
.line 63
|
||
|
const/4 v3, 0x4
|
||
|
|
||
|
.line 67
|
||
|
:goto_0
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mSampleRate:I
|
||
|
|
||
|
iget v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mBitDepth:I
|
||
|
|
||
|
invoke-static {v0, v3, v1}, Landroid/media/AudioTrack;->getMinBufferSize(III)I
|
||
|
|
||
|
move-result v0
|
||
|
|
||
|
mul-int/lit8 v5, v0, 0x2
|
||
|
|
||
|
.line 68
|
||
|
iget v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mCodecId:I
|
||
|
|
||
|
const v1, 0x15001
|
||
|
|
||
|
if-ne v0, v1, :cond_0
|
||
|
|
||
|
.line 70
|
||
|
mul-int/lit8 v5, v5, 0x5
|
||
|
|
||
|
.line 72
|
||
|
:cond_0
|
||
|
new-instance v0, Landroid/media/AudioTrack;
|
||
|
|
||
|
const/4 v1, 0x3
|
||
|
|
||
|
iget v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mSampleRate:I
|
||
|
|
||
|
iget v4, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mBitDepth:I
|
||
|
|
||
|
invoke-direct/range {v0 .. v6}, Landroid/media/AudioTrack;-><init>(IIIIII)V
|
||
|
|
||
|
iput-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioTrack:Landroid/media/AudioTrack;
|
||
|
|
||
|
.line 76
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioTrack:Landroid/media/AudioTrack;
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/media/AudioTrack;->play()V
|
||
|
|
||
|
.line 78
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->TAG:Ljava/lang/String;
|
||
|
|
||
|
new-instance v1, Ljava/lang/StringBuilder;
|
||
|
|
||
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
||
|
|
||
|
const-string v2, "mSampleRate = "
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
iget v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mSampleRate:I
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
const-string v2, " mChannel ="
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
iget v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mChannel:I
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
const-string v2, " mbitdepht="
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
iget v2, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mBitDepth:I
|
||
|
|
||
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
||
|
|
||
|
move-result-object v1
|
||
|
|
||
|
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
||
|
|
||
|
.line 80
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioHandler:Lcom/viatech/VrPlayer/AudioPlayer$AudioHandler;
|
||
|
|
||
|
const/16 v1, 0x2710
|
||
|
|
||
|
invoke-virtual {v0, v1}, Lcom/viatech/VrPlayer/AudioPlayer$AudioHandler;->sendEmptyMessage(I)Z
|
||
|
|
||
|
.line 81
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
return v0
|
||
|
|
||
|
.line 65
|
||
|
:cond_1
|
||
|
const/16 v3, 0xc
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|
||
|
|
||
|
.method public stop()I
|
||
|
.locals 4
|
||
|
|
||
|
.prologue
|
||
|
const/4 v3, 0x0
|
||
|
|
||
|
.line 141
|
||
|
:try_start_0
|
||
|
iget-object v1, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
monitor-enter v1
|
||
|
:try_end_0
|
||
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
||
|
|
||
|
.line 142
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
:try_start_1
|
||
|
iput v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mPaused:I
|
||
|
|
||
|
.line 143
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mDataList:Ljava/util/List;
|
||
|
|
||
|
invoke-interface {v0}, Ljava/util/List;->clear()V
|
||
|
|
||
|
.line 144
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mObject:Ljava/lang/Object;
|
||
|
|
||
|
invoke-virtual {v0}, Ljava/lang/Object;->notify()V
|
||
|
|
||
|
.line 145
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioHandler:Lcom/viatech/VrPlayer/AudioPlayer$AudioHandler;
|
||
|
|
||
|
const/16 v2, 0x2710
|
||
|
|
||
|
invoke-virtual {v0, v2}, Lcom/viatech/VrPlayer/AudioPlayer$AudioHandler;->removeMessages(I)V
|
||
|
|
||
|
.line 146
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mWorkThread:Landroid/os/HandlerThread;
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/os/HandlerThread;->quit()Z
|
||
|
|
||
|
.line 148
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
if-eqz v0, :cond_0
|
||
|
|
||
|
.line 149
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/media/MediaCodec;->stop()V
|
||
|
|
||
|
.line 150
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mMediaCodec:Landroid/media/MediaCodec;
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/media/MediaCodec;->release()V
|
||
|
|
||
|
.line 153
|
||
|
:cond_0
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioTrack:Landroid/media/AudioTrack;
|
||
|
|
||
|
if-eqz v0, :cond_1
|
||
|
|
||
|
.line 154
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioTrack:Landroid/media/AudioTrack;
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/media/AudioTrack;->stop()V
|
||
|
|
||
|
.line 155
|
||
|
iget-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioTrack:Landroid/media/AudioTrack;
|
||
|
|
||
|
invoke-virtual {v0}, Landroid/media/AudioTrack;->release()V
|
||
|
|
||
|
.line 156
|
||
|
const/4 v0, 0x0
|
||
|
|
||
|
iput-object v0, p0, Lcom/viatech/VrPlayer/AudioPlayer;->mAudioTrack:Landroid/media/AudioTrack;
|
||
|
|
||
|
.line 158
|
||
|
:cond_1
|
||
|
monitor-exit v1
|
||
|
|
||
|
.line 162
|
||
|
:goto_0
|
||
|
return v3
|
||
|
|
||
|
.line 158
|
||
|
:catchall_0
|
||
|
move-exception v0
|
||
|
|
||
|
monitor-exit v1
|
||
|
:try_end_1
|
||
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
||
|
|
||
|
:try_start_2
|
||
|
throw v0
|
||
|
:try_end_2
|
||
|
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0
|
||
|
|
||
|
.line 159
|
||
|
:catch_0
|
||
|
move-exception v0
|
||
|
|
||
|
.line 160
|
||
|
invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V
|
||
|
|
||
|
goto :goto_0
|
||
|
.end method
|