485 lines
12 KiB
Smali
485 lines
12 KiB
Smali
.class public Lorg/webrtc/SurfaceEglRenderer;
|
|
.super Lorg/webrtc/EglRenderer;
|
|
.source "SurfaceEglRenderer.java"
|
|
|
|
# interfaces
|
|
.implements Landroid/view/SurfaceHolder$Callback;
|
|
|
|
|
|
# static fields
|
|
.field public static final TAG:Ljava/lang/String; = "SurfaceEglRenderer"
|
|
|
|
|
|
# instance fields
|
|
.field public frameRotation:I
|
|
|
|
.field public isFirstFrameRendered:Z
|
|
|
|
.field public isRenderingPaused:Z
|
|
|
|
.field public final layoutLock:Ljava/lang/Object;
|
|
|
|
.field public rendererEvents:Lorg/webrtc/RendererCommon$RendererEvents;
|
|
|
|
.field public rotatedFrameHeight:I
|
|
|
|
.field public rotatedFrameWidth:I
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Ljava/lang/String;)V
|
|
.locals 0
|
|
|
|
invoke-direct {p0, p1}, Lorg/webrtc/EglRenderer;-><init>(Ljava/lang/String;)V
|
|
|
|
new-instance p1, Ljava/lang/Object;
|
|
|
|
invoke-direct {p1}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-object p1, p0, Lorg/webrtc/SurfaceEglRenderer;->layoutLock:Ljava/lang/Object;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private logD(Ljava/lang/String;)V
|
|
.locals 2
|
|
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
iget-object v1, p0, Lorg/webrtc/EglRenderer;->name:Ljava/lang/String;
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v1, ": "
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
const-string v0, "SurfaceEglRenderer"
|
|
|
|
invoke-static {v0, p1}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private updateFrameDimensionsAndReportEvents(Lorg/webrtc/VideoFrame;)V
|
|
.locals 5
|
|
|
|
iget-object v0, p0, Lorg/webrtc/SurfaceEglRenderer;->layoutLock:Ljava/lang/Object;
|
|
|
|
monitor-enter v0
|
|
|
|
:try_start_0
|
|
iget-boolean v1, p0, Lorg/webrtc/SurfaceEglRenderer;->isRenderingPaused:Z
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
monitor-exit v0
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
iget-boolean v1, p0, Lorg/webrtc/SurfaceEglRenderer;->isFirstFrameRendered:Z
|
|
|
|
if-nez v1, :cond_1
|
|
|
|
const/4 v1, 0x1
|
|
|
|
iput-boolean v1, p0, Lorg/webrtc/SurfaceEglRenderer;->isFirstFrameRendered:Z
|
|
|
|
const-string v1, "Reporting first rendered frame."
|
|
|
|
invoke-direct {p0, v1}, Lorg/webrtc/SurfaceEglRenderer;->logD(Ljava/lang/String;)V
|
|
|
|
iget-object v1, p0, Lorg/webrtc/SurfaceEglRenderer;->rendererEvents:Lorg/webrtc/RendererCommon$RendererEvents;
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
iget-object v1, p0, Lorg/webrtc/SurfaceEglRenderer;->rendererEvents:Lorg/webrtc/RendererCommon$RendererEvents;
|
|
|
|
invoke-interface {v1}, Lorg/webrtc/RendererCommon$RendererEvents;->onFirstFrameRendered()V
|
|
|
|
:cond_1
|
|
iget v1, p0, Lorg/webrtc/SurfaceEglRenderer;->rotatedFrameWidth:I
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getRotatedWidth()I
|
|
|
|
move-result v2
|
|
|
|
if-ne v1, v2, :cond_2
|
|
|
|
iget v1, p0, Lorg/webrtc/SurfaceEglRenderer;->rotatedFrameHeight:I
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getRotatedHeight()I
|
|
|
|
move-result v2
|
|
|
|
if-ne v1, v2, :cond_2
|
|
|
|
iget v1, p0, Lorg/webrtc/SurfaceEglRenderer;->frameRotation:I
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getRotation()I
|
|
|
|
move-result v2
|
|
|
|
if-eq v1, v2, :cond_4
|
|
|
|
:cond_2
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v2, "Reporting frame resolution changed to "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getBuffer()Lorg/webrtc/VideoFrame$Buffer;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-interface {v2}, Lorg/webrtc/VideoFrame$Buffer;->getWidth()I
|
|
|
|
move-result v2
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
const-string v2, "x"
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getBuffer()Lorg/webrtc/VideoFrame$Buffer;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-interface {v2}, Lorg/webrtc/VideoFrame$Buffer;->getHeight()I
|
|
|
|
move-result v2
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
const-string v2, " with rotation "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getRotation()I
|
|
|
|
move-result v2
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-direct {p0, v1}, Lorg/webrtc/SurfaceEglRenderer;->logD(Ljava/lang/String;)V
|
|
|
|
iget-object v1, p0, Lorg/webrtc/SurfaceEglRenderer;->rendererEvents:Lorg/webrtc/RendererCommon$RendererEvents;
|
|
|
|
if-eqz v1, :cond_3
|
|
|
|
iget-object v1, p0, Lorg/webrtc/SurfaceEglRenderer;->rendererEvents:Lorg/webrtc/RendererCommon$RendererEvents;
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getBuffer()Lorg/webrtc/VideoFrame$Buffer;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-interface {v2}, Lorg/webrtc/VideoFrame$Buffer;->getWidth()I
|
|
|
|
move-result v2
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getBuffer()Lorg/webrtc/VideoFrame$Buffer;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-interface {v3}, Lorg/webrtc/VideoFrame$Buffer;->getHeight()I
|
|
|
|
move-result v3
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getRotation()I
|
|
|
|
move-result v4
|
|
|
|
invoke-interface {v1, v2, v3, v4}, Lorg/webrtc/RendererCommon$RendererEvents;->onFrameResolutionChanged(III)V
|
|
|
|
:cond_3
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getRotatedWidth()I
|
|
|
|
move-result v1
|
|
|
|
iput v1, p0, Lorg/webrtc/SurfaceEglRenderer;->rotatedFrameWidth:I
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getRotatedHeight()I
|
|
|
|
move-result v1
|
|
|
|
iput v1, p0, Lorg/webrtc/SurfaceEglRenderer;->rotatedFrameHeight:I
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getRotation()I
|
|
|
|
move-result p1
|
|
|
|
iput p1, p0, Lorg/webrtc/SurfaceEglRenderer;->frameRotation:I
|
|
|
|
:cond_4
|
|
monitor-exit v0
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
monitor-exit v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public disableFpsReduction()V
|
|
.locals 2
|
|
|
|
iget-object v0, p0, Lorg/webrtc/SurfaceEglRenderer;->layoutLock:Ljava/lang/Object;
|
|
|
|
monitor-enter v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
:try_start_0
|
|
iput-boolean v1, p0, Lorg/webrtc/SurfaceEglRenderer;->isRenderingPaused:Z
|
|
|
|
monitor-exit v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
invoke-super {p0}, Lorg/webrtc/EglRenderer;->disableFpsReduction()V
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception v1
|
|
|
|
:try_start_1
|
|
monitor-exit v0
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
throw v1
|
|
.end method
|
|
|
|
.method public init(Lorg/webrtc/EglBase$Context;Lorg/webrtc/RendererCommon$RendererEvents;[ILorg/webrtc/RendererCommon$GlDrawer;)V
|
|
.locals 1
|
|
|
|
invoke-static {}, Lorg/webrtc/ThreadUtils;->checkIsOnMainThread()V
|
|
|
|
iput-object p2, p0, Lorg/webrtc/SurfaceEglRenderer;->rendererEvents:Lorg/webrtc/RendererCommon$RendererEvents;
|
|
|
|
iget-object p2, p0, Lorg/webrtc/SurfaceEglRenderer;->layoutLock:Ljava/lang/Object;
|
|
|
|
monitor-enter p2
|
|
|
|
const/4 v0, 0x0
|
|
|
|
:try_start_0
|
|
iput-boolean v0, p0, Lorg/webrtc/SurfaceEglRenderer;->isFirstFrameRendered:Z
|
|
|
|
iput v0, p0, Lorg/webrtc/SurfaceEglRenderer;->rotatedFrameWidth:I
|
|
|
|
iput v0, p0, Lorg/webrtc/SurfaceEglRenderer;->rotatedFrameHeight:I
|
|
|
|
iput v0, p0, Lorg/webrtc/SurfaceEglRenderer;->frameRotation:I
|
|
|
|
monitor-exit p2
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
invoke-super {p0, p1, p3, p4}, Lorg/webrtc/EglRenderer;->init(Lorg/webrtc/EglBase$Context;[ILorg/webrtc/RendererCommon$GlDrawer;)V
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
:try_start_1
|
|
monitor-exit p2
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public init(Lorg/webrtc/EglBase$Context;[ILorg/webrtc/RendererCommon$GlDrawer;)V
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-virtual {p0, p1, v0, p2, p3}, Lorg/webrtc/SurfaceEglRenderer;->init(Lorg/webrtc/EglBase$Context;Lorg/webrtc/RendererCommon$RendererEvents;[ILorg/webrtc/RendererCommon$GlDrawer;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public onFrame(Lorg/webrtc/VideoFrame;)V
|
|
.locals 0
|
|
|
|
invoke-direct {p0, p1}, Lorg/webrtc/SurfaceEglRenderer;->updateFrameDimensionsAndReportEvents(Lorg/webrtc/VideoFrame;)V
|
|
|
|
invoke-super {p0, p1}, Lorg/webrtc/EglRenderer;->onFrame(Lorg/webrtc/VideoFrame;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public pauseVideo()V
|
|
.locals 2
|
|
|
|
iget-object v0, p0, Lorg/webrtc/SurfaceEglRenderer;->layoutLock:Ljava/lang/Object;
|
|
|
|
monitor-enter v0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
:try_start_0
|
|
iput-boolean v1, p0, Lorg/webrtc/SurfaceEglRenderer;->isRenderingPaused:Z
|
|
|
|
monitor-exit v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
invoke-super {p0}, Lorg/webrtc/EglRenderer;->pauseVideo()V
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception v1
|
|
|
|
:try_start_1
|
|
monitor-exit v0
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
throw v1
|
|
.end method
|
|
|
|
.method public setFpsReduction(F)V
|
|
.locals 2
|
|
|
|
iget-object v0, p0, Lorg/webrtc/SurfaceEglRenderer;->layoutLock:Ljava/lang/Object;
|
|
|
|
monitor-enter v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
cmpl-float v1, p1, v1
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v1, 0x0
|
|
|
|
:goto_0
|
|
:try_start_0
|
|
iput-boolean v1, p0, Lorg/webrtc/SurfaceEglRenderer;->isRenderingPaused:Z
|
|
|
|
monitor-exit v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
invoke-super {p0, p1}, Lorg/webrtc/EglRenderer;->setFpsReduction(F)V
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
:try_start_1
|
|
monitor-exit v0
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public surfaceChanged(Landroid/view/SurfaceHolder;III)V
|
|
.locals 1
|
|
|
|
invoke-static {}, Lorg/webrtc/ThreadUtils;->checkIsOnMainThread()V
|
|
|
|
new-instance p1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v0, "surfaceChanged: format: "
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
const-string p2, " size: "
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
const-string p2, "x"
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1, p4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p1}, Lorg/webrtc/SurfaceEglRenderer;->logD(Ljava/lang/String;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public surfaceCreated(Landroid/view/SurfaceHolder;)V
|
|
.locals 0
|
|
|
|
invoke-static {}, Lorg/webrtc/ThreadUtils;->checkIsOnMainThread()V
|
|
|
|
invoke-interface {p1}, Landroid/view/SurfaceHolder;->getSurface()Landroid/view/Surface;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p0, p1}, Lorg/webrtc/EglRenderer;->createEglSurface(Landroid/view/Surface;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public surfaceDestroyed(Landroid/view/SurfaceHolder;)V
|
|
.locals 1
|
|
|
|
invoke-static {}, Lorg/webrtc/ThreadUtils;->checkIsOnMainThread()V
|
|
|
|
new-instance p1, Ljava/util/concurrent/CountDownLatch;
|
|
|
|
const/4 v0, 0x1
|
|
|
|
invoke-direct {p1, v0}, Ljava/util/concurrent/CountDownLatch;-><init>(I)V
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
|
|
|
|
new-instance v0, Lc0/d/a;
|
|
|
|
invoke-direct {v0, p1}, Lc0/d/a;-><init>(Ljava/util/concurrent/CountDownLatch;)V
|
|
|
|
invoke-virtual {p0, v0}, Lorg/webrtc/EglRenderer;->releaseEglSurface(Ljava/lang/Runnable;)V
|
|
|
|
invoke-static {p1}, Lorg/webrtc/ThreadUtils;->awaitUninterruptibly(Ljava/util/concurrent/CountDownLatch;)V
|
|
|
|
return-void
|
|
.end method
|