ScreenCapturerAndroid.smali
.class public Lorg/webrtc/ali/ScreenCapturerAndroid;
.super Ljava/lang/Object;
.source "ScreenCapturerAndroid.java"
# interfaces
.implements Lorg/webrtc/ali/VideoCapturer;
.implements Lorg/webrtc/ali/SurfaceTextureHelper$OnTextureFrameAvailableListener;
# static fields
.field private static final DISPLAY_FLAGS:I
.field private static final VIRTUAL_DISPLAY_DPI:I
# instance fields
.field private capturerObserver:Lorg/webrtc/ali/VideoCapturer$CapturerObserver;
.field private height:I
.field private isDisposed:Z
.field private mediaProjection:Landroid/media/projection/MediaProjection;
.field private final mediaProjectionCallback:Landroid/media/projection/MediaProjection$Callback;
.field private mediaProjectionManager:Landroid/media/projection/MediaProjectionManager;
.field private final mediaProjectionPermissionResultData:Landroid/content/Intent;
.field private numCapturedFrames:J
.field private surfaceTextureHelper:Lorg/webrtc/ali/SurfaceTextureHelper;
.field private virtualDisplay:Landroid/hardware/display/VirtualDisplay;
.field private width:I
# direct methods
.method static constructor <clinit>()V
.registers 1
const v0, 0x156c
invoke-static {v0}, Lnp/NPFog;->d(I)I
move-result v0
sput v0, Lorg/webrtc/ali/ScreenCapturerAndroid;->DISPLAY_FLAGS:I
const v0, 0x14ff
invoke-static {v0}, Lnp/NPFog;->d(I)I
move-result v0
sput v0, Lorg/webrtc/ali/ScreenCapturerAndroid;->VIRTUAL_DISPLAY_DPI:I
return-void
.end method
.method public constructor <init>(Landroid/content/Intent;Landroid/media/projection/MediaProjection$Callback;)V
.registers 5
.param p1, "mediaProjectionPermissionResultData" # Landroid/content/Intent;
.param p2, "mediaProjectionCallback" # Landroid/media/projection/MediaProjection$Callback;
.line 68
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 53
const-wide/16 v0, 0x0
iput-wide v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->numCapturedFrames:J
.line 55
const/4 v0, 0x0
iput-boolean v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->isDisposed:Z
.line 69
iput-object p1, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->mediaProjectionPermissionResultData:Landroid/content/Intent;
.line 70
iput-object p2, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->mediaProjectionCallback:Landroid/media/projection/MediaProjection$Callback;
.line 71
return-void
.end method
.method static synthetic access$000(Lorg/webrtc/ali/ScreenCapturerAndroid;)Lorg/webrtc/ali/SurfaceTextureHelper;
.registers 2
.param p0, "x0" # Lorg/webrtc/ali/ScreenCapturerAndroid;
.line 38
iget-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->surfaceTextureHelper:Lorg/webrtc/ali/SurfaceTextureHelper;
return-object v0
.end method
.method static synthetic access$100(Lorg/webrtc/ali/ScreenCapturerAndroid;)Lorg/webrtc/ali/VideoCapturer$CapturerObserver;
.registers 2
.param p0, "x0" # Lorg/webrtc/ali/ScreenCapturerAndroid;
.line 38
iget-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->capturerObserver:Lorg/webrtc/ali/VideoCapturer$CapturerObserver;
return-object v0
.end method
.method static synthetic access$200(Lorg/webrtc/ali/ScreenCapturerAndroid;)Landroid/hardware/display/VirtualDisplay;
.registers 2
.param p0, "x0" # Lorg/webrtc/ali/ScreenCapturerAndroid;
.line 38
iget-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->virtualDisplay:Landroid/hardware/display/VirtualDisplay;
return-object v0
.end method
.method static synthetic access$202(Lorg/webrtc/ali/ScreenCapturerAndroid;Landroid/hardware/display/VirtualDisplay;)Landroid/hardware/display/VirtualDisplay;
.registers 2
.param p0, "x0" # Lorg/webrtc/ali/ScreenCapturerAndroid;
.param p1, "x1" # Landroid/hardware/display/VirtualDisplay;
.line 38
iput-object p1, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->virtualDisplay:Landroid/hardware/display/VirtualDisplay;
return-object p1
.end method
.method static synthetic access$300(Lorg/webrtc/ali/ScreenCapturerAndroid;)Landroid/media/projection/MediaProjection;
.registers 2
.param p0, "x0" # Lorg/webrtc/ali/ScreenCapturerAndroid;
.line 38
iget-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->mediaProjection:Landroid/media/projection/MediaProjection;
return-object v0
.end method
.method static synthetic access$302(Lorg/webrtc/ali/ScreenCapturerAndroid;Landroid/media/projection/MediaProjection;)Landroid/media/projection/MediaProjection;
.registers 2
.param p0, "x0" # Lorg/webrtc/ali/ScreenCapturerAndroid;
.param p1, "x1" # Landroid/media/projection/MediaProjection;
.line 38
iput-object p1, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->mediaProjection:Landroid/media/projection/MediaProjection;
return-object p1
.end method
.method static synthetic access$400(Lorg/webrtc/ali/ScreenCapturerAndroid;)Landroid/media/projection/MediaProjection$Callback;
.registers 2
.param p0, "x0" # Lorg/webrtc/ali/ScreenCapturerAndroid;
.line 38
iget-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->mediaProjectionCallback:Landroid/media/projection/MediaProjection$Callback;
return-object v0
.end method
.method static synthetic access$500(Lorg/webrtc/ali/ScreenCapturerAndroid;)V
.registers 1
.param p0, "x0" # Lorg/webrtc/ali/ScreenCapturerAndroid;
.line 38
invoke-direct {p0}, Lorg/webrtc/ali/ScreenCapturerAndroid;->createVirtualDisplay()V
return-void
.end method
.method private checkNotDisposed()V
.registers 3
.line 74
iget-boolean v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->isDisposed:Z
if-nez v0, :cond_5
.line 77
return-void
.line 75
:cond_5
new-instance v0, Ljava/lang/RuntimeException;
const-string v1, "capturer is disposed."
invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method private createVirtualDisplay()V
.registers 13
.line 181
iget-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->surfaceTextureHelper:Lorg/webrtc/ali/SurfaceTextureHelper;
invoke-virtual {v0}, Lorg/webrtc/ali/SurfaceTextureHelper;->getSurfaceTexture()Landroid/graphics/SurfaceTexture;
move-result-object v0
iget v1, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->width:I
iget v2, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->height:I
invoke-virtual {v0, v1, v2}, Landroid/graphics/SurfaceTexture;->setDefaultBufferSize(II)V
.line 182
iget-object v3, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->mediaProjection:Landroid/media/projection/MediaProjection;
iget v5, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->width:I
iget v6, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->height:I
new-instance v9, Landroid/view/Surface;
iget-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->surfaceTextureHelper:Lorg/webrtc/ali/SurfaceTextureHelper;
.line 183
invoke-virtual {v0}, Lorg/webrtc/ali/SurfaceTextureHelper;->getSurfaceTexture()Landroid/graphics/SurfaceTexture;
move-result-object v0
invoke-direct {v9, v0}, Landroid/view/Surface;-><init>(Landroid/graphics/SurfaceTexture;)V
.line 182
const-string v4, "WebRTC_ScreenCapture"
const/16 v7, 0x190
const/4 v8, 0x3
const/4 v10, 0x0
const/4 v11, 0x0
invoke-virtual/range {v3 .. v11}, Landroid/media/projection/MediaProjection;->createVirtualDisplay(Ljava/lang/String;IIIILandroid/view/Surface;Landroid/hardware/display/VirtualDisplay$Callback;Landroid/os/Handler;)Landroid/hardware/display/VirtualDisplay;
move-result-object v0
iput-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->virtualDisplay:Landroid/hardware/display/VirtualDisplay;
.line 185
return-void
.end method
# virtual methods
.method public declared-synchronized changeCaptureFormat(III)V
.registers 6
.param p1, "width" # I
.param p2, "height" # I
.param p3, "ignoredFramerate" # I
monitor-enter p0
.line 158
:try_start_1
invoke-direct {p0}, Lorg/webrtc/ali/ScreenCapturerAndroid;->checkNotDisposed()V
.line 160
iput p1, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->width:I
.line 161
iput p2, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->height:I
.line 163
iget-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->virtualDisplay:Landroid/hardware/display/VirtualDisplay;
:try_end_a
.catchall {:try_start_1 .. :try_end_a} :catchall_1e
if-nez v0, :cond_e
.line 165
monitor-exit p0
return-void
.line 171
:cond_e
:try_start_e
iget-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->surfaceTextureHelper:Lorg/webrtc/ali/SurfaceTextureHelper;
invoke-virtual {v0}, Lorg/webrtc/ali/SurfaceTextureHelper;->getHandler()Landroid/os/Handler;
move-result-object v0
new-instance v1, Lorg/webrtc/ali/ScreenCapturerAndroid$2;
invoke-direct {v1, p0}, Lorg/webrtc/ali/ScreenCapturerAndroid$2;-><init>(Lorg/webrtc/ali/ScreenCapturerAndroid;)V
invoke-static {v0, v1}, Lorg/webrtc/ali/ThreadUtils;->invokeAtFrontUninterruptibly(Landroid/os/Handler;Ljava/lang/Runnable;)V
:try_end_1c
.catchall {:try_start_e .. :try_end_1c} :catchall_1e
.line 178
monitor-exit p0
return-void
.line 157
.end local p0 # "this":Lorg/webrtc/ali/ScreenCapturerAndroid;
.end local p1 # "width":I
.end local p2 # "height":I
.end local p3 # "ignoredFramerate":I
:catchall_1e
move-exception p1
monitor-exit p0
throw p1
.end method
.method public declared-synchronized dispose()V
.registers 2
monitor-enter p0
.line 144
const/4 v0, 0x1
:try_start_2
iput-boolean v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->isDisposed:Z
:try_end_4
.catchall {:try_start_2 .. :try_end_4} :catchall_6
.line 145
monitor-exit p0
return-void
.line 143
.end local p0 # "this":Lorg/webrtc/ali/ScreenCapturerAndroid;
:catchall_6
move-exception v0
monitor-exit p0
throw v0
.end method
.method public getNumCapturedFrames()J
.registers 3
.line 201
iget-wide v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->numCapturedFrames:J
return-wide v0
.end method
.method public declared-synchronized initialize(Lorg/webrtc/ali/SurfaceTextureHelper;Landroid/content/Context;Lorg/webrtc/ali/VideoCapturer$CapturerObserver;)V
.registers 6
.param p1, "surfaceTextureHelper" # Lorg/webrtc/ali/SurfaceTextureHelper;
.param p2, "applicationContext" # Landroid/content/Context;
.param p3, "capturerObserver" # Lorg/webrtc/ali/VideoCapturer$CapturerObserver;
monitor-enter p0
.line 82
:try_start_1
invoke-direct {p0}, Lorg/webrtc/ali/ScreenCapturerAndroid;->checkNotDisposed()V
.line 84
if-eqz p3, :cond_20
.line 87
iput-object p3, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->capturerObserver:Lorg/webrtc/ali/VideoCapturer$CapturerObserver;
.line 89
if-eqz p1, :cond_18
.line 92
iput-object p1, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->surfaceTextureHelper:Lorg/webrtc/ali/SurfaceTextureHelper;
.line 94
const-string v0, "media_projection"
invoke-virtual {p2, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/media/projection/MediaProjectionManager;
iput-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->mediaProjectionManager:Landroid/media/projection/MediaProjectionManager;
:try_end_16
.catchall {:try_start_1 .. :try_end_16} :catchall_28
.line 96
monitor-exit p0
return-void
.line 90
.end local p0 # "this":Lorg/webrtc/ali/ScreenCapturerAndroid;
:cond_18
:try_start_18
new-instance v0, Ljava/lang/RuntimeException;
const-string v1, "surfaceTextureHelper not set."
invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
throw v0
.line 85
:cond_20
new-instance v0, Ljava/lang/RuntimeException;
const-string v1, "capturerObserver not set."
invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
throw v0
:try_end_28
.catchall {:try_start_18 .. :try_end_28} :catchall_28
.line 81
.end local p1 # "surfaceTextureHelper":Lorg/webrtc/ali/SurfaceTextureHelper;
.end local p2 # "applicationContext":Landroid/content/Context;
.end local p3 # "capturerObserver":Lorg/webrtc/ali/VideoCapturer$CapturerObserver;
:catchall_28
move-exception p1
monitor-exit p0
throw p1
.end method
.method public isScreencast()Z
.registers 2
.line 197
const/4 v0, 0x1
return v0
.end method
.method public onTextureFrameAvailable(I[FJ)V
.registers 15
.param p1, "oesTextureId" # I
.param p2, "transformMatrix" # [F
.param p3, "timestampNs" # J
.line 190
iget-wide v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->numCapturedFrames:J
const-wide/16 v2, 0x1
add-long/2addr v0, v2
iput-wide v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->numCapturedFrames:J
.line 191
iget-object v2, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->capturerObserver:Lorg/webrtc/ali/VideoCapturer$CapturerObserver;
iget v3, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->width:I
iget v4, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->height:I
const/4 v7, 0x0
move v5, p1
move-object v6, p2
move-wide v8, p3
invoke-interface/range {v2 .. v9}, Lorg/webrtc/ali/VideoCapturer$CapturerObserver;->onTextureFrameCaptured(III[FIJ)V
.line 193
return-void
.end method
.method public declared-synchronized startCapture(III)V
.registers 7
.param p1, "width" # I
.param p2, "height" # I
.param p3, "ignoredFramerate" # I
monitor-enter p0
.line 101
:try_start_1
invoke-direct {p0}, Lorg/webrtc/ali/ScreenCapturerAndroid;->checkNotDisposed()V
.line 103
iput p1, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->width:I
.line 104
iput p2, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->height:I
.line 106
iget-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->mediaProjectionManager:Landroid/media/projection/MediaProjectionManager;
const/4 v1, -0x1
iget-object v2, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->mediaProjectionPermissionResultData:Landroid/content/Intent;
invoke-virtual {v0, v1, v2}, Landroid/media/projection/MediaProjectionManager;->getMediaProjection(ILandroid/content/Intent;)Landroid/media/projection/MediaProjection;
move-result-object v0
iput-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->mediaProjection:Landroid/media/projection/MediaProjection;
.line 110
iget-object v1, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->mediaProjectionCallback:Landroid/media/projection/MediaProjection$Callback;
iget-object v2, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->surfaceTextureHelper:Lorg/webrtc/ali/SurfaceTextureHelper;
invoke-virtual {v2}, Lorg/webrtc/ali/SurfaceTextureHelper;->getHandler()Landroid/os/Handler;
move-result-object v2
invoke-virtual {v0, v1, v2}, Landroid/media/projection/MediaProjection;->registerCallback(Landroid/media/projection/MediaProjection$Callback;Landroid/os/Handler;)V
.line 112
invoke-direct {p0}, Lorg/webrtc/ali/ScreenCapturerAndroid;->createVirtualDisplay()V
.line 113
iget-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->capturerObserver:Lorg/webrtc/ali/VideoCapturer$CapturerObserver;
const/4 v1, 0x1
invoke-interface {v0, v1}, Lorg/webrtc/ali/VideoCapturer$CapturerObserver;->onCapturerStarted(Z)V
.line 114
iget-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->surfaceTextureHelper:Lorg/webrtc/ali/SurfaceTextureHelper;
invoke-virtual {v0, p0}, Lorg/webrtc/ali/SurfaceTextureHelper;->startListening(Lorg/webrtc/ali/SurfaceTextureHelper$OnTextureFrameAvailableListener;)V
:try_end_2c
.catchall {:try_start_1 .. :try_end_2c} :catchall_2e
.line 115
monitor-exit p0
return-void
.line 100
.end local p0 # "this":Lorg/webrtc/ali/ScreenCapturerAndroid;
.end local p1 # "width":I
.end local p2 # "height":I
.end local p3 # "ignoredFramerate":I
:catchall_2e
move-exception p1
monitor-exit p0
throw p1
.end method
.method public declared-synchronized stopCapture()V
.registers 3
monitor-enter p0
.line 119
:try_start_1
invoke-direct {p0}, Lorg/webrtc/ali/ScreenCapturerAndroid;->checkNotDisposed()V
.line 120
iget-object v0, p0, Lorg/webrtc/ali/ScreenCapturerAndroid;->surfaceTextureHelper:Lorg/webrtc/ali/SurfaceTextureHelper;
invoke-virtual {v0}, Lorg/webrtc/ali/SurfaceTextureHelper;->getHandler()Landroid/os/Handler;
move-result-object v0
new-instance v1, Lorg/webrtc/ali/ScreenCapturerAndroid$1;
invoke-direct {v1, p0}, Lorg/webrtc/ali/ScreenCapturerAndroid$1;-><init>(Lorg/webrtc/ali/ScreenCapturerAndroid;)V
invoke-static {v0, v1}, Lorg/webrtc/ali/ThreadUtils;->invokeAtFrontUninterruptibly(Landroid/os/Handler;Ljava/lang/Runnable;)V
:try_end_12
.catchall {:try_start_1 .. :try_end_12} :catchall_14
.line 140
monitor-exit p0
return-void
.line 118
.end local p0 # "this":Lorg/webrtc/ali/ScreenCapturerAndroid;
:catchall_14
move-exception v0
monitor-exit p0
throw v0
.end method