.class Lorg/webrtc/HardwareVideoEncoder; .super Ljava/lang/Object; .source "HardwareVideoEncoder.java" # interfaces .implements Lorg/webrtc/VideoEncoder; # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Lorg/webrtc/HardwareVideoEncoder$YuvFormat;, Lorg/webrtc/HardwareVideoEncoder$BusyCount; } .end annotation # static fields .field private static final DEQUEUE_OUTPUT_BUFFER_TIMEOUT_US:I = 0x186a0 .field private static final KEY_BITRATE_MODE:Ljava/lang/String; = "bitrate-mode" .field private static final MAX_ENCODER_Q_SIZE:I = 0x2 .field private static final MAX_VIDEO_FRAMERATE:I = 0x1e .field private static final MEDIA_CODEC_RELEASE_TIMEOUT_MS:I = 0x1388 .field private static final TAG:Ljava/lang/String; = "HardwareVideoEncoder" .field private static final VIDEO_AVC_LEVEL_3:I = 0x100 .field private static final VIDEO_AVC_PROFILE_HIGH:I = 0x8 .field private static final VIDEO_ControlRateConstant:I = 0x2 # instance fields .field private adjustedBitrate:I .field private automaticResizeOn:Z .field private final bitrateAdjuster:Lorg/webrtc/BitrateAdjuster; .field private callback:Lorg/webrtc/VideoEncoder$Callback; .field private codec:Lorg/webrtc/MediaCodecWrapper; .field private final codecName:Ljava/lang/String; .field private final codecType:Lorg/webrtc/VideoCodecMimeType; .field private configBuffer:Ljava/nio/ByteBuffer; .field private final encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .field private final forcedKeyFrameNs:J .field private height:I .field private final keyFrameIntervalSec:I .field private lastKeyFrameNs:J .field private final mediaCodecWrapperFactory:Lorg/webrtc/MediaCodecWrapperFactory; .field private outputBuffers:[Ljava/nio/ByteBuffer; .field private final outputBuffersBusyCount:Lorg/webrtc/HardwareVideoEncoder$BusyCount; .field private final outputBuilders:Ljava/util/concurrent/BlockingDeque; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/concurrent/BlockingDeque<", "Lorg/webrtc/EncodedImage$Builder;", ">;" } .end annotation .end field .field private outputThread:Ljava/lang/Thread; .field private final outputThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .field private final params:Ljava/util/Map; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/Map<", "Ljava/lang/String;", "Ljava/lang/String;", ">;" } .end annotation .end field .field private volatile running:Z .field private final sharedContext:Lorg/webrtc/EglBase14$Context; .field private volatile shutdownException:Ljava/lang/Exception; .field private final surfaceColorFormat:Ljava/lang/Integer; .field private final textureDrawer:Lorg/webrtc/GlRectDrawer; .field private textureEglBase:Lorg/webrtc/EglBase14; .field private textureInputSurface:Landroid/view/Surface; .field private useSurfaceMode:Z .field private final videoFrameDrawer:Lorg/webrtc/VideoFrameDrawer; .field private width:I .field private final yuvColorFormat:Ljava/lang/Integer; .field private final yuvFormat:Lorg/webrtc/HardwareVideoEncoder$YuvFormat; # direct methods .method public constructor (Lorg/webrtc/MediaCodecWrapperFactory;Ljava/lang/String;Lorg/webrtc/VideoCodecMimeType;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/util/Map;IILorg/webrtc/BitrateAdjuster;Lorg/webrtc/EglBase14$Context;)V .locals 3 .annotation system Ldalvik/annotation/Signature; value = { "(", "Lorg/webrtc/MediaCodecWrapperFactory;", "Ljava/lang/String;", "Lorg/webrtc/VideoCodecMimeType;", "Ljava/lang/Integer;", "Ljava/lang/Integer;", "Ljava/util/Map<", "Ljava/lang/String;", "Ljava/lang/String;", ">;II", "Lorg/webrtc/BitrateAdjuster;", "Lorg/webrtc/EglBase14$Context;", ")V" } .end annotation .line 185 invoke-direct {p0}, Ljava/lang/Object;->()V .line 120 new-instance v0, Lorg/webrtc/GlRectDrawer; invoke-direct {v0}, Lorg/webrtc/GlRectDrawer;->()V iput-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->textureDrawer:Lorg/webrtc/GlRectDrawer; .line 121 new-instance v0, Lorg/webrtc/VideoFrameDrawer; invoke-direct {v0}, Lorg/webrtc/VideoFrameDrawer;->()V iput-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->videoFrameDrawer:Lorg/webrtc/VideoFrameDrawer; .line 124 new-instance v0, Ljava/util/concurrent/LinkedBlockingDeque; invoke-direct {v0}, Ljava/util/concurrent/LinkedBlockingDeque;->()V iput-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuilders:Ljava/util/concurrent/BlockingDeque; .line 126 new-instance v0, Lorg/webrtc/ThreadUtils$ThreadChecker; invoke-direct {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->()V iput-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 127 new-instance v1, Lorg/webrtc/ThreadUtils$ThreadChecker; invoke-direct {v1}, Lorg/webrtc/ThreadUtils$ThreadChecker;->()V iput-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->outputThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 128 new-instance v1, Lorg/webrtc/HardwareVideoEncoder$BusyCount; const/4 v2, 0x0 invoke-direct {v1, v2}, Lorg/webrtc/HardwareVideoEncoder$BusyCount;->(Lorg/webrtc/HardwareVideoEncoder$1;)V iput-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuffersBusyCount:Lorg/webrtc/HardwareVideoEncoder$BusyCount; iput-object p1, p0, Lorg/webrtc/HardwareVideoEncoder;->mediaCodecWrapperFactory:Lorg/webrtc/MediaCodecWrapperFactory; iput-object p2, p0, Lorg/webrtc/HardwareVideoEncoder;->codecName:Ljava/lang/String; iput-object p3, p0, Lorg/webrtc/HardwareVideoEncoder;->codecType:Lorg/webrtc/VideoCodecMimeType; iput-object p4, p0, Lorg/webrtc/HardwareVideoEncoder;->surfaceColorFormat:Ljava/lang/Integer; iput-object p5, p0, Lorg/webrtc/HardwareVideoEncoder;->yuvColorFormat:Ljava/lang/Integer; .line 191 invoke-virtual {p5}, Ljava/lang/Integer;->intValue()I move-result p1 invoke-static {p1}, Lorg/webrtc/HardwareVideoEncoder$YuvFormat;->valueOf(I)Lorg/webrtc/HardwareVideoEncoder$YuvFormat; move-result-object p1 iput-object p1, p0, Lorg/webrtc/HardwareVideoEncoder;->yuvFormat:Lorg/webrtc/HardwareVideoEncoder$YuvFormat; iput-object p6, p0, Lorg/webrtc/HardwareVideoEncoder;->params:Ljava/util/Map; iput p7, p0, Lorg/webrtc/HardwareVideoEncoder;->keyFrameIntervalSec:I .line 194 sget-object p1, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit; int-to-long p2, p8 invoke-virtual {p1, p2, p3}, Ljava/util/concurrent/TimeUnit;->toNanos(J)J move-result-wide p1 iput-wide p1, p0, Lorg/webrtc/HardwareVideoEncoder;->forcedKeyFrameNs:J iput-object p9, p0, Lorg/webrtc/HardwareVideoEncoder;->bitrateAdjuster:Lorg/webrtc/BitrateAdjuster; iput-object p10, p0, Lorg/webrtc/HardwareVideoEncoder;->sharedContext:Lorg/webrtc/EglBase14$Context; .line 199 invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->detachThread()V return-void .end method .method static synthetic access$100(Lorg/webrtc/HardwareVideoEncoder;)Z .locals 0 .line 36 iget-boolean p0, p0, Lorg/webrtc/HardwareVideoEncoder;->running:Z return p0 .end method .method static synthetic access$200(Lorg/webrtc/HardwareVideoEncoder;)V .locals 0 .line 36 invoke-direct {p0}, Lorg/webrtc/HardwareVideoEncoder;->releaseCodecOnOutputThread()V return-void .end method .method private canUseSurface()Z .locals 1 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->sharedContext:Lorg/webrtc/EglBase14$Context; if-eqz v0, :cond_0 iget-object p0, p0, Lorg/webrtc/HardwareVideoEncoder;->surfaceColorFormat:Ljava/lang/Integer; if-eqz p0, :cond_0 const/4 p0, 0x1 goto :goto_0 :cond_0 const/4 p0, 0x0 :goto_0 return p0 .end method .method private createOutputThread()Ljava/lang/Thread; .locals 1 .line 520 new-instance v0, Lorg/webrtc/HardwareVideoEncoder$1; invoke-direct {v0, p0}, Lorg/webrtc/HardwareVideoEncoder$1;->(Lorg/webrtc/HardwareVideoEncoder;)V return-object v0 .end method .method private encodeByteBuffer(Lorg/webrtc/VideoFrame;Lorg/webrtc/VideoFrame$Buffer;I)Lorg/webrtc/VideoCodecStatus; .locals 12 const-string v0, "HardwareVideoEncoder" iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 414 invoke-virtual {v1}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V .line 416 invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getTimestampNs()J move-result-wide v1 const-wide/16 v3, 0x1f4 add-long/2addr v1, v3 const-wide/16 v3, 0x3e8 div-long v9, v1, v3 :try_start_0 iget-object p1, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; const-wide/16 v1, 0x0 .line 421 invoke-interface {p1, v1, v2}, Lorg/webrtc/MediaCodecWrapper;->dequeueInputBuffer(J)I move-result v6 :try_end_0 .catch Ljava/lang/IllegalStateException; {:try_start_0 .. :try_end_0} :catch_2 const/4 p1, -0x1 if-ne v6, p1, :cond_0 const-string p0, "Dropped frame, no input buffers available" .line 429 invoke-static {v0, p0}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V .line 430 sget-object p0, Lorg/webrtc/VideoCodecStatus;->NO_OUTPUT:Lorg/webrtc/VideoCodecStatus; return-object p0 :cond_0 :try_start_1 iget-object p1, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; .line 435 invoke-interface {p1}, Lorg/webrtc/MediaCodecWrapper;->getInputBuffers()[Ljava/nio/ByteBuffer; move-result-object p1 aget-object p1, p1, v6 :try_end_1 .catch Ljava/lang/IllegalStateException; {:try_start_1 .. :try_end_1} :catch_1 .line 440 invoke-virtual {p0, p1, p2}, Lorg/webrtc/HardwareVideoEncoder;->fillInputBuffer(Ljava/nio/ByteBuffer;Lorg/webrtc/VideoFrame$Buffer;)V :try_start_2 iget-object v5, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; const/4 v7, 0x0 const/4 v11, 0x0 move v8, p3 .line 443 invoke-interface/range {v5 .. v11}, Lorg/webrtc/MediaCodecWrapper;->queueInputBuffer(IIIJI)V :try_end_2 .catch Ljava/lang/IllegalStateException; {:try_start_2 .. :try_end_2} :catch_0 .line 450 sget-object p0, Lorg/webrtc/VideoCodecStatus;->OK:Lorg/webrtc/VideoCodecStatus; return-object p0 :catch_0 move-exception p0 const-string p1, "queueInputBuffer failed" .line 446 invoke-static {v0, p1, p0}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V .line 448 sget-object p0, Lorg/webrtc/VideoCodecStatus;->ERROR:Lorg/webrtc/VideoCodecStatus; return-object p0 :catch_1 move-exception p0 const-string p1, "getInputBuffers failed" .line 437 invoke-static {v0, p1, p0}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V .line 438 sget-object p0, Lorg/webrtc/VideoCodecStatus;->ERROR:Lorg/webrtc/VideoCodecStatus; return-object p0 :catch_2 move-exception p0 const-string p1, "dequeueInputBuffer failed" .line 423 invoke-static {v0, p1, p0}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V .line 424 sget-object p0, Lorg/webrtc/VideoCodecStatus;->ERROR:Lorg/webrtc/VideoCodecStatus; return-object p0 .end method .method private encodeTextureBuffer(Lorg/webrtc/VideoFrame;)Lorg/webrtc/VideoCodecStatus; .locals 5 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 395 invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V const/16 v0, 0x4000 .line 399 :try_start_0 invoke-static {v0}, Landroid/opengl/GLES20;->glClear(I)V .line 401 new-instance v0, Lorg/webrtc/VideoFrame; .line 402 invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getBuffer()Lorg/webrtc/VideoFrame$Buffer; move-result-object v1 invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getTimestampNs()J move-result-wide v2 const/4 v4, 0x0 invoke-direct {v0, v1, v4, v2, v3}, Lorg/webrtc/VideoFrame;->(Lorg/webrtc/VideoFrame$Buffer;IJ)V iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->videoFrameDrawer:Lorg/webrtc/VideoFrameDrawer; iget-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->textureDrawer:Lorg/webrtc/GlRectDrawer; const/4 v3, 0x0 .line 403 invoke-virtual {v1, v0, v2, v3}, Lorg/webrtc/VideoFrameDrawer;->drawFrame(Lorg/webrtc/VideoFrame;Lorg/webrtc/RendererCommon$GlDrawer;Landroid/graphics/Matrix;)V iget-object p0, p0, Lorg/webrtc/HardwareVideoEncoder;->textureEglBase:Lorg/webrtc/EglBase14; .line 404 invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getTimestampNs()J move-result-wide v0 invoke-interface {p0, v0, v1}, Lorg/webrtc/EglBase14;->swapBuffers(J)V :try_end_0 .catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_0 .line 409 sget-object p0, Lorg/webrtc/VideoCodecStatus;->OK:Lorg/webrtc/VideoCodecStatus; return-object p0 :catch_0 move-exception p0 const-string p1, "HardwareVideoEncoder" const-string v0, "encodeTexture failed" .line 406 invoke-static {p1, v0, p0}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V .line 407 sget-object p0, Lorg/webrtc/VideoCodecStatus;->ERROR:Lorg/webrtc/VideoCodecStatus; return-object p0 .end method .method private initEncodeInternal()Lorg/webrtc/VideoCodecStatus; .locals 9 const-string v0, "HardwareVideoEncoder" const-string v1, "Unknown profile level id: " const-string v2, "Format: " iget-object v3, p0, Lorg/webrtc/HardwareVideoEncoder;->encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 224 invoke-virtual {v3}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V const-wide/16 v3, -0x1 iput-wide v3, p0, Lorg/webrtc/HardwareVideoEncoder;->lastKeyFrameNs:J :try_start_0 iget-object v3, p0, Lorg/webrtc/HardwareVideoEncoder;->mediaCodecWrapperFactory:Lorg/webrtc/MediaCodecWrapperFactory; iget-object v4, p0, Lorg/webrtc/HardwareVideoEncoder;->codecName:Ljava/lang/String; .line 229 invoke-interface {v3, v4}, Lorg/webrtc/MediaCodecWrapperFactory;->createByCodecName(Ljava/lang/String;)Lorg/webrtc/MediaCodecWrapper; move-result-object v3 iput-object v3, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; :try_end_0 .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1 .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_1 iget-boolean v3, p0, Lorg/webrtc/HardwareVideoEncoder;->useSurfaceMode:Z if-eqz v3, :cond_0 iget-object v3, p0, Lorg/webrtc/HardwareVideoEncoder;->surfaceColorFormat:Ljava/lang/Integer; goto :goto_0 :cond_0 iget-object v3, p0, Lorg/webrtc/HardwareVideoEncoder;->yuvColorFormat:Ljava/lang/Integer; .line 235 :goto_0 invoke-virtual {v3}, Ljava/lang/Integer;->intValue()I move-result v3 :try_start_1 iget-object v4, p0, Lorg/webrtc/HardwareVideoEncoder;->codecType:Lorg/webrtc/VideoCodecMimeType; .line 237 invoke-virtual {v4}, Lorg/webrtc/VideoCodecMimeType;->mimeType()Ljava/lang/String; move-result-object v4 iget v5, p0, Lorg/webrtc/HardwareVideoEncoder;->width:I iget v6, p0, Lorg/webrtc/HardwareVideoEncoder;->height:I invoke-static {v4, v5, v6}, Landroid/media/MediaFormat;->createVideoFormat(Ljava/lang/String;II)Landroid/media/MediaFormat; move-result-object v4 const-string v5, "bitrate" iget v6, p0, Lorg/webrtc/HardwareVideoEncoder;->adjustedBitrate:I .line 238 invoke-virtual {v4, v5, v6}, Landroid/media/MediaFormat;->setInteger(Ljava/lang/String;I)V const-string v5, "bitrate-mode" const/4 v6, 0x2 .line 239 invoke-virtual {v4, v5, v6}, Landroid/media/MediaFormat;->setInteger(Ljava/lang/String;I)V const-string v5, "color-format" .line 240 invoke-virtual {v4, v5, v3}, Landroid/media/MediaFormat;->setInteger(Ljava/lang/String;I)V const-string v3, "frame-rate" iget-object v5, p0, Lorg/webrtc/HardwareVideoEncoder;->bitrateAdjuster:Lorg/webrtc/BitrateAdjuster; .line 241 invoke-interface {v5}, Lorg/webrtc/BitrateAdjuster;->getCodecConfigFramerate()I move-result v5 invoke-virtual {v4, v3, v5}, Landroid/media/MediaFormat;->setInteger(Ljava/lang/String;I)V const-string v3, "i-frame-interval" iget v5, p0, Lorg/webrtc/HardwareVideoEncoder;->keyFrameIntervalSec:I .line 242 invoke-virtual {v4, v3, v5}, Landroid/media/MediaFormat;->setInteger(Ljava/lang/String;I)V iget-object v3, p0, Lorg/webrtc/HardwareVideoEncoder;->codecType:Lorg/webrtc/VideoCodecMimeType; .line 243 sget-object v5, Lorg/webrtc/VideoCodecMimeType;->H264:Lorg/webrtc/VideoCodecMimeType; const/4 v6, 0x1 if-ne v3, v5, :cond_6 iget-object v3, p0, Lorg/webrtc/HardwareVideoEncoder;->params:Ljava/util/Map; const-string v5, "profile-level-id" .line 244 invoke-interface {v3, v5}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v3 check-cast v3, Ljava/lang/String; :try_end_1 .catch Ljava/lang/IllegalStateException; {:try_start_1 .. :try_end_1} :catch_0 const-string v5, "42e01f" if-nez v3, :cond_1 move-object v3, v5 .line 248 :cond_1 :try_start_2 invoke-virtual {v3}, Ljava/lang/String;->hashCode()I move-result v7 const v8, 0x5bab3b7e if-eq v7, v8, :cond_3 const v5, 0x5f19c386 if-eq v7, v5, :cond_2 goto :goto_1 :cond_2 const-string v5, "640c1f" invoke-virtual {v3, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v5 if-eqz v5, :cond_4 const/4 v5, 0x0 goto :goto_2 :cond_3 invoke-virtual {v3, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v5 if-eqz v5, :cond_4 move v5, v6 goto :goto_2 :cond_4 :goto_1 const/4 v5, -0x1 :goto_2 if-eqz v5, :cond_5 if-eq v5, v6, :cond_6 .line 256 new-instance v5, Ljava/lang/StringBuilder; invoke-direct {v5, v1}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V invoke-virtual {v5, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)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}, Lorg/webrtc/Logging;->w(Ljava/lang/String;Ljava/lang/String;)V goto :goto_3 :cond_5 const-string v1, "profile" const/16 v3, 0x8 .line 250 invoke-virtual {v4, v1, v3}, Landroid/media/MediaFormat;->setInteger(Ljava/lang/String;I)V const-string v1, "level" const/16 v3, 0x100 .line 251 invoke-virtual {v4, v1, v3}, Landroid/media/MediaFormat;->setInteger(Ljava/lang/String;I)V .line 259 :cond_6 :goto_3 new-instance v1, Ljava/lang/StringBuilder; invoke-direct {v1, v2}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V invoke-virtual {v1, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)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}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; const/4 v2, 0x0 .line 260 invoke-interface {v1, v4, v2, v2, v6}, Lorg/webrtc/MediaCodecWrapper;->configure(Landroid/media/MediaFormat;Landroid/view/Surface;Landroid/media/MediaCrypto;I)V iget-boolean v1, p0, Lorg/webrtc/HardwareVideoEncoder;->useSurfaceMode:Z if-eqz v1, :cond_7 iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->sharedContext:Lorg/webrtc/EglBase14$Context; .line 264 sget-object v2, Lorg/webrtc/EglBase;->CONFIG_RECORDABLE:[I invoke-static {v1, v2}, Lorg/webrtc/EglBase;->createEgl14(Lorg/webrtc/EglBase14$Context;[I)Lorg/webrtc/EglBase14; move-result-object v1 iput-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->textureEglBase:Lorg/webrtc/EglBase14; iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; .line 265 invoke-interface {v1}, Lorg/webrtc/MediaCodecWrapper;->createInputSurface()Landroid/view/Surface; move-result-object v1 iput-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->textureInputSurface:Landroid/view/Surface; iget-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->textureEglBase:Lorg/webrtc/EglBase14; .line 266 invoke-interface {v2, v1}, Lorg/webrtc/EglBase14;->createSurface(Landroid/view/Surface;)V iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->textureEglBase:Lorg/webrtc/EglBase14; .line 267 invoke-interface {v1}, Lorg/webrtc/EglBase14;->makeCurrent()V :cond_7 iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; .line 270 invoke-interface {v1}, Lorg/webrtc/MediaCodecWrapper;->start()V iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; .line 271 invoke-interface {v1}, Lorg/webrtc/MediaCodecWrapper;->getOutputBuffers()[Ljava/nio/ByteBuffer; move-result-object v1 iput-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuffers:[Ljava/nio/ByteBuffer; :try_end_2 .catch Ljava/lang/IllegalStateException; {:try_start_2 .. :try_end_2} :catch_0 iput-boolean v6, p0, Lorg/webrtc/HardwareVideoEncoder;->running:Z iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->outputThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 279 invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->detachThread()V .line 280 invoke-direct {p0}, Lorg/webrtc/HardwareVideoEncoder;->createOutputThread()Ljava/lang/Thread; move-result-object v0 iput-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->outputThread:Ljava/lang/Thread; .line 281 invoke-virtual {v0}, Ljava/lang/Thread;->start()V .line 283 sget-object p0, Lorg/webrtc/VideoCodecStatus;->OK:Lorg/webrtc/VideoCodecStatus; return-object p0 :catch_0 move-exception v1 const-string v2, "initEncodeInternal failed" .line 273 invoke-static {v0, v2, v1}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V .line 274 invoke-virtual {p0}, Lorg/webrtc/HardwareVideoEncoder;->release()Lorg/webrtc/VideoCodecStatus; .line 275 sget-object p0, Lorg/webrtc/VideoCodecStatus;->FALLBACK_SOFTWARE:Lorg/webrtc/VideoCodecStatus; return-object p0 .line 231 :catch_1 new-instance v1, Ljava/lang/StringBuilder; const-string v2, "Cannot create media encoder " invoke-direct {v1, v2}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V iget-object p0, p0, Lorg/webrtc/HardwareVideoEncoder;->codecName:Ljava/lang/String; invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p0 invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object p0 invoke-static {v0, p0}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;)V .line 232 sget-object p0, Lorg/webrtc/VideoCodecStatus;->FALLBACK_SOFTWARE:Lorg/webrtc/VideoCodecStatus; return-object p0 .end method .method private releaseCodecOnOutputThread()V .locals 3 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->outputThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 611 invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V const-string v0, "Releasing MediaCodec on output thread" const-string v1, "HardwareVideoEncoder" .line 612 invoke-static {v1, v0}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuffersBusyCount:Lorg/webrtc/HardwareVideoEncoder$BusyCount; .line 613 invoke-virtual {v0}, Lorg/webrtc/HardwareVideoEncoder$BusyCount;->waitForZero()V :try_start_0 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; .line 615 invoke-interface {v0}, Lorg/webrtc/MediaCodecWrapper;->stop()V :try_end_0 .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0 goto :goto_0 :catch_0 move-exception v0 const-string v2, "Media encoder stop failed" .line 617 invoke-static {v1, v2, v0}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V :goto_0 :try_start_1 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; .line 620 invoke-interface {v0}, Lorg/webrtc/MediaCodecWrapper;->release()V :try_end_1 .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1 goto :goto_1 :catch_1 move-exception v0 const-string v2, "Media encoder release failed" .line 622 invoke-static {v1, v2, v0}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V iput-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->shutdownException:Ljava/lang/Exception; :goto_1 const/4 v0, 0x0 iput-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->configBuffer:Ljava/nio/ByteBuffer; const-string p0, "Release on output thread done" .line 627 invoke-static {v1, p0}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V return-void .end method .method private requestKeyFrame(J)V .locals 3 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 503 invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V .line 509 :try_start_0 new-instance v0, Landroid/os/Bundle; invoke-direct {v0}, Landroid/os/Bundle;->()V const-string v1, "request-sync" const/4 v2, 0x0 .line 510 invoke-virtual {v0, v1, v2}, Landroid/os/Bundle;->putInt(Ljava/lang/String;I)V iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; .line 511 invoke-interface {v1, v0}, Lorg/webrtc/MediaCodecWrapper;->setParameters(Landroid/os/Bundle;)V :try_end_0 .catch Ljava/lang/IllegalStateException; {:try_start_0 .. :try_end_0} :catch_0 iput-wide p1, p0, Lorg/webrtc/HardwareVideoEncoder;->lastKeyFrameNs:J return-void :catch_0 move-exception p0 const-string p1, "HardwareVideoEncoder" const-string p2, "requestKeyFrame failed" .line 513 invoke-static {p1, p2, p0}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V return-void .end method .method private resetCodec(IIZ)Lorg/webrtc/VideoCodecStatus; .locals 2 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 486 invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V .line 487 invoke-virtual {p0}, Lorg/webrtc/HardwareVideoEncoder;->release()Lorg/webrtc/VideoCodecStatus; move-result-object v0 .line 488 sget-object v1, Lorg/webrtc/VideoCodecStatus;->OK:Lorg/webrtc/VideoCodecStatus; if-eq v0, v1, :cond_0 return-object v0 :cond_0 iput p1, p0, Lorg/webrtc/HardwareVideoEncoder;->width:I iput p2, p0, Lorg/webrtc/HardwareVideoEncoder;->height:I iput-boolean p3, p0, Lorg/webrtc/HardwareVideoEncoder;->useSurfaceMode:Z .line 494 invoke-direct {p0}, Lorg/webrtc/HardwareVideoEncoder;->initEncodeInternal()Lorg/webrtc/VideoCodecStatus; move-result-object p0 return-object p0 .end method .method private shouldForceKeyFrame(J)Z .locals 4 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 498 invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V iget-wide v0, p0, Lorg/webrtc/HardwareVideoEncoder;->forcedKeyFrameNs:J const-wide/16 v2, 0x0 cmp-long v2, v0, v2 if-lez v2, :cond_0 iget-wide v2, p0, Lorg/webrtc/HardwareVideoEncoder;->lastKeyFrameNs:J add-long/2addr v2, v0 cmp-long p0, p1, v2 if-lez p0, :cond_0 const/4 p0, 0x1 goto :goto_0 :cond_0 const/4 p0, 0x0 :goto_0 return p0 .end method .method private updateBitrate()Lorg/webrtc/VideoCodecStatus; .locals 3 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->outputThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 631 invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->bitrateAdjuster:Lorg/webrtc/BitrateAdjuster; .line 632 invoke-interface {v0}, Lorg/webrtc/BitrateAdjuster;->getAdjustedBitrateBps()I move-result v0 iput v0, p0, Lorg/webrtc/HardwareVideoEncoder;->adjustedBitrate:I .line 634 :try_start_0 new-instance v0, Landroid/os/Bundle; invoke-direct {v0}, Landroid/os/Bundle;->()V const-string v1, "video-bitrate" iget v2, p0, Lorg/webrtc/HardwareVideoEncoder;->adjustedBitrate:I .line 635 invoke-virtual {v0, v1, v2}, Landroid/os/Bundle;->putInt(Ljava/lang/String;I)V iget-object p0, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; .line 636 invoke-interface {p0, v0}, Lorg/webrtc/MediaCodecWrapper;->setParameters(Landroid/os/Bundle;)V .line 637 sget-object p0, Lorg/webrtc/VideoCodecStatus;->OK:Lorg/webrtc/VideoCodecStatus; :try_end_0 .catch Ljava/lang/IllegalStateException; {:try_start_0 .. :try_end_0} :catch_0 return-object p0 :catch_0 move-exception p0 const-string v0, "HardwareVideoEncoder" const-string v1, "updateBitrate failed" .line 639 invoke-static {v0, v1, p0}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V .line 640 sget-object p0, Lorg/webrtc/VideoCodecStatus;->ERROR:Lorg/webrtc/VideoCodecStatus; return-object p0 .end method # virtual methods .method protected deliverEncodedImage()V .locals 8 const-string v0, "HardwareVideoEncoder" const-string v1, "Prepending config frame of size " const-string v2, "Config frame generated. Offset: " iget-object v3, p0, Lorg/webrtc/HardwareVideoEncoder;->outputThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 533 invoke-virtual {v3}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V .line 535 :try_start_0 new-instance v3, Landroid/media/MediaCodec$BufferInfo; invoke-direct {v3}, Landroid/media/MediaCodec$BufferInfo;->()V iget-object v4, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; const-wide/32 v5, 0x186a0 .line 536 invoke-interface {v4, v3, v5, v6}, Lorg/webrtc/MediaCodecWrapper;->dequeueOutputBuffer(Landroid/media/MediaCodec$BufferInfo;J)I move-result v4 if-gez v4, :cond_1 const/4 v1, -0x3 if-ne v4, v1, :cond_0 iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuffersBusyCount:Lorg/webrtc/HardwareVideoEncoder$BusyCount; .line 539 invoke-virtual {v1}, Lorg/webrtc/HardwareVideoEncoder$BusyCount;->waitForZero()V iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; .line 540 invoke-interface {v1}, Lorg/webrtc/MediaCodecWrapper;->getOutputBuffers()[Ljava/nio/ByteBuffer; move-result-object v1 iput-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuffers:[Ljava/nio/ByteBuffer; :cond_0 return-void :cond_1 iget-object v5, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuffers:[Ljava/nio/ByteBuffer; .line 545 aget-object v5, v5, v4 .line 546 iget v6, v3, Landroid/media/MediaCodec$BufferInfo;->offset:I invoke-virtual {v5, v6}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer; .line 547 iget v6, v3, Landroid/media/MediaCodec$BufferInfo;->offset:I iget v7, v3, Landroid/media/MediaCodec$BufferInfo;->size:I add-int/2addr v6, v7 invoke-virtual {v5, v6}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer; .line 549 iget v6, v3, Landroid/media/MediaCodec$BufferInfo;->flags:I and-int/lit8 v6, v6, 0x2 if-eqz v6, :cond_2 .line 550 new-instance v1, Ljava/lang/StringBuilder; invoke-direct {v1, v2}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V iget v2, v3, Landroid/media/MediaCodec$BufferInfo;->offset:I invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v1 const-string v2, ". Size: " invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 iget v2, v3, Landroid/media/MediaCodec$BufferInfo;->size: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}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V .line 551 iget v1, v3, Landroid/media/MediaCodec$BufferInfo;->size:I invoke-static {v1}, Ljava/nio/ByteBuffer;->allocateDirect(I)Ljava/nio/ByteBuffer; move-result-object v1 iput-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->configBuffer:Ljava/nio/ByteBuffer; .line 552 invoke-virtual {v1, v5}, Ljava/nio/ByteBuffer;->put(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer; goto/16 :goto_3 :cond_2 iget-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->bitrateAdjuster:Lorg/webrtc/BitrateAdjuster; .line 554 iget v6, v3, Landroid/media/MediaCodec$BufferInfo;->size:I invoke-interface {v2, v6}, Lorg/webrtc/BitrateAdjuster;->reportEncodedFrame(I)V iget v2, p0, Lorg/webrtc/HardwareVideoEncoder;->adjustedBitrate:I iget-object v6, p0, Lorg/webrtc/HardwareVideoEncoder;->bitrateAdjuster:Lorg/webrtc/BitrateAdjuster; .line 555 invoke-interface {v6}, Lorg/webrtc/BitrateAdjuster;->getAdjustedBitrateBps()I move-result v6 if-eq v2, v6, :cond_3 .line 556 invoke-direct {p0}, Lorg/webrtc/HardwareVideoEncoder;->updateBitrate()Lorg/webrtc/VideoCodecStatus; .line 559 :cond_3 iget v2, v3, Landroid/media/MediaCodec$BufferInfo;->flags:I const/4 v6, 0x1 and-int/2addr v2, v6 if-eqz v2, :cond_4 goto :goto_0 :cond_4 const/4 v6, 0x0 :goto_0 if-eqz v6, :cond_5 const-string v2, "Sync frame generated" .line 561 invoke-static {v0, v2}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V :cond_5 if-eqz v6, :cond_6 iget-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->codecType:Lorg/webrtc/VideoCodecMimeType; .line 565 sget-object v7, Lorg/webrtc/VideoCodecMimeType;->H264:Lorg/webrtc/VideoCodecMimeType; if-ne v2, v7, :cond_6 .line 566 new-instance v2, Ljava/lang/StringBuilder; invoke-direct {v2, v1}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->configBuffer:Ljava/nio/ByteBuffer; .line 567 invoke-virtual {v1}, Ljava/nio/ByteBuffer;->capacity()I move-result v1 invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v1 const-string v2, " to output buffer with offset " invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 iget v2, v3, Landroid/media/MediaCodec$BufferInfo;->offset:I invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v1 const-string v2, ", size " invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 iget v2, v3, Landroid/media/MediaCodec$BufferInfo;->size: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 .line 566 invoke-static {v0, v1}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V .line 570 iget v1, v3, Landroid/media/MediaCodec$BufferInfo;->size:I iget-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->configBuffer:Ljava/nio/ByteBuffer; invoke-virtual {v2}, Ljava/nio/ByteBuffer;->capacity()I move-result v2 add-int/2addr v1, v2 invoke-static {v1}, Ljava/nio/ByteBuffer;->allocateDirect(I)Ljava/nio/ByteBuffer; move-result-object v1 iget-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->configBuffer:Ljava/nio/ByteBuffer; .line 571 invoke-virtual {v2}, Ljava/nio/ByteBuffer;->rewind()Ljava/nio/Buffer; iget-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->configBuffer:Ljava/nio/ByteBuffer; .line 572 invoke-virtual {v1, v2}, Ljava/nio/ByteBuffer;->put(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer; .line 573 invoke-virtual {v1, v5}, Ljava/nio/ByteBuffer;->put(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer; .line 574 invoke-virtual {v1}, Ljava/nio/ByteBuffer;->rewind()Ljava/nio/Buffer; goto :goto_1 .line 576 :cond_6 invoke-virtual {v5}, Ljava/nio/ByteBuffer;->slice()Ljava/nio/ByteBuffer; move-result-object v1 :goto_1 if-eqz v6, :cond_7 .line 580 sget-object v2, Lorg/webrtc/EncodedImage$FrameType;->VideoFrameKey:Lorg/webrtc/EncodedImage$FrameType; goto :goto_2 .line 581 :cond_7 sget-object v2, Lorg/webrtc/EncodedImage$FrameType;->VideoFrameDelta:Lorg/webrtc/EncodedImage$FrameType; :goto_2 iget-object v3, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuffersBusyCount:Lorg/webrtc/HardwareVideoEncoder$BusyCount; .line 583 invoke-virtual {v3}, Lorg/webrtc/HardwareVideoEncoder$BusyCount;->increment()V iget-object v3, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuilders:Ljava/util/concurrent/BlockingDeque; .line 584 invoke-interface {v3}, Ljava/util/concurrent/BlockingDeque;->poll()Ljava/lang/Object; move-result-object v3 check-cast v3, Lorg/webrtc/EncodedImage$Builder; .line 585 new-instance v5, Lorg/webrtc/HardwareVideoEncoder$$ExternalSyntheticLambda0; invoke-direct {v5, p0, v4}, Lorg/webrtc/HardwareVideoEncoder$$ExternalSyntheticLambda0;->(Lorg/webrtc/HardwareVideoEncoder;I)V .line 586 invoke-virtual {v3, v1, v5}, Lorg/webrtc/EncodedImage$Builder;->setBuffer(Ljava/nio/ByteBuffer;Ljava/lang/Runnable;)Lorg/webrtc/EncodedImage$Builder; move-result-object v1 .line 598 invoke-virtual {v1, v2}, Lorg/webrtc/EncodedImage$Builder;->setFrameType(Lorg/webrtc/EncodedImage$FrameType;)Lorg/webrtc/EncodedImage$Builder; move-result-object v1 .line 599 invoke-virtual {v1}, Lorg/webrtc/EncodedImage$Builder;->createEncodedImage()Lorg/webrtc/EncodedImage; move-result-object v1 iget-object p0, p0, Lorg/webrtc/HardwareVideoEncoder;->callback:Lorg/webrtc/VideoEncoder$Callback; .line 601 new-instance v2, Lorg/webrtc/VideoEncoder$CodecSpecificInfo; invoke-direct {v2}, Lorg/webrtc/VideoEncoder$CodecSpecificInfo;->()V invoke-interface {p0, v1, v2}, Lorg/webrtc/VideoEncoder$Callback;->onEncodedFrame(Lorg/webrtc/EncodedImage;Lorg/webrtc/VideoEncoder$CodecSpecificInfo;)V .line 603 invoke-virtual {v1}, Lorg/webrtc/EncodedImage;->release()V :try_end_0 .catch Ljava/lang/IllegalStateException; {:try_start_0 .. :try_end_0} :catch_0 goto :goto_3 :catch_0 move-exception p0 const-string v1, "deliverOutput failed" .line 606 invoke-static {v0, v1, p0}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V :goto_3 return-void .end method .method public encode(Lorg/webrtc/VideoFrame;Lorg/webrtc/VideoEncoder$EncodeInfo;)Lorg/webrtc/VideoCodecStatus; .locals 8 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 332 invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; if-nez v0, :cond_0 .line 334 sget-object p0, Lorg/webrtc/VideoCodecStatus;->UNINITIALIZED:Lorg/webrtc/VideoCodecStatus; return-object p0 .line 337 :cond_0 invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getBuffer()Lorg/webrtc/VideoFrame$Buffer; move-result-object v0 .line 338 instance-of v1, v0, Lorg/webrtc/VideoFrame$TextureBuffer; .line 341 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 .line 342 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 .line 343 invoke-direct {p0}, Lorg/webrtc/HardwareVideoEncoder;->canUseSurface()Z move-result v4 const/4 v5, 0x1 const/4 v6, 0x0 if-eqz v4, :cond_1 if-eqz v1, :cond_1 move v1, v5 goto :goto_0 :cond_1 move v1, v6 :goto_0 iget v4, p0, Lorg/webrtc/HardwareVideoEncoder;->width:I if-ne v2, v4, :cond_2 iget v4, p0, Lorg/webrtc/HardwareVideoEncoder;->height:I if-ne v3, v4, :cond_2 iget-boolean v4, p0, Lorg/webrtc/HardwareVideoEncoder;->useSurfaceMode:Z if-eq v1, v4, :cond_3 .line 345 :cond_2 invoke-direct {p0, v2, v3, v1}, Lorg/webrtc/HardwareVideoEncoder;->resetCodec(IIZ)Lorg/webrtc/VideoCodecStatus; move-result-object v1 .line 346 sget-object v2, Lorg/webrtc/VideoCodecStatus;->OK:Lorg/webrtc/VideoCodecStatus; if-eq v1, v2, :cond_3 return-object v1 :cond_3 iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuilders:Ljava/util/concurrent/BlockingDeque; .line 351 invoke-interface {v1}, Ljava/util/concurrent/BlockingDeque;->size()I move-result v1 const/4 v2, 0x2 if-le v1, v2, :cond_4 const-string p0, "HardwareVideoEncoder" const-string p1, "Dropped frame, encoder queue full" .line 353 invoke-static {p0, p1}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;)V .line 354 sget-object p0, Lorg/webrtc/VideoCodecStatus;->NO_OUTPUT:Lorg/webrtc/VideoCodecStatus; return-object p0 .line 358 :cond_4 iget-object p2, p2, Lorg/webrtc/VideoEncoder$EncodeInfo;->frameTypes:[Lorg/webrtc/EncodedImage$FrameType; array-length v1, p2 move v3, v6 :goto_1 if-ge v6, v1, :cond_6 aget-object v4, p2, v6 .line 359 sget-object v7, Lorg/webrtc/EncodedImage$FrameType;->VideoFrameKey:Lorg/webrtc/EncodedImage$FrameType; if-ne v4, v7, :cond_5 move v3, v5 :cond_5 add-int/lit8 v6, v6, 0x1 goto :goto_1 :cond_6 if-nez v3, :cond_7 .line 364 invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getTimestampNs()J move-result-wide v3 invoke-direct {p0, v3, v4}, Lorg/webrtc/HardwareVideoEncoder;->shouldForceKeyFrame(J)Z move-result p2 if-eqz p2, :cond_8 .line 365 :cond_7 invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getTimestampNs()J move-result-wide v3 invoke-direct {p0, v3, v4}, Lorg/webrtc/HardwareVideoEncoder;->requestKeyFrame(J)V .line 370 :cond_8 invoke-interface {v0}, Lorg/webrtc/VideoFrame$Buffer;->getHeight()I move-result p2 invoke-interface {v0}, Lorg/webrtc/VideoFrame$Buffer;->getWidth()I move-result v1 mul-int/2addr p2, v1 mul-int/lit8 p2, p2, 0x3 div-int/2addr p2, v2 .line 371 invoke-static {}, Lorg/webrtc/EncodedImage;->builder()Lorg/webrtc/EncodedImage$Builder; move-result-object v1 .line 372 invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getTimestampNs()J move-result-wide v2 invoke-virtual {v1, v2, v3}, Lorg/webrtc/EncodedImage$Builder;->setCaptureTimeNs(J)Lorg/webrtc/EncodedImage$Builder; move-result-object v1 .line 373 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}, Lorg/webrtc/EncodedImage$Builder;->setEncodedWidth(I)Lorg/webrtc/EncodedImage$Builder; move-result-object v1 .line 374 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}, Lorg/webrtc/EncodedImage$Builder;->setEncodedHeight(I)Lorg/webrtc/EncodedImage$Builder; move-result-object v1 .line 375 invoke-virtual {p1}, Lorg/webrtc/VideoFrame;->getRotation()I move-result v2 invoke-virtual {v1, v2}, Lorg/webrtc/EncodedImage$Builder;->setRotation(I)Lorg/webrtc/EncodedImage$Builder; move-result-object v1 iget-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuilders:Ljava/util/concurrent/BlockingDeque; .line 376 invoke-interface {v2, v1}, Ljava/util/concurrent/BlockingDeque;->offer(Ljava/lang/Object;)Z iget-boolean v1, p0, Lorg/webrtc/HardwareVideoEncoder;->useSurfaceMode:Z if-eqz v1, :cond_9 .line 380 invoke-direct {p0, p1}, Lorg/webrtc/HardwareVideoEncoder;->encodeTextureBuffer(Lorg/webrtc/VideoFrame;)Lorg/webrtc/VideoCodecStatus; move-result-object p1 goto :goto_2 .line 382 :cond_9 invoke-direct {p0, p1, v0, p2}, Lorg/webrtc/HardwareVideoEncoder;->encodeByteBuffer(Lorg/webrtc/VideoFrame;Lorg/webrtc/VideoFrame$Buffer;I)Lorg/webrtc/VideoCodecStatus; move-result-object p1 .line 386 :goto_2 sget-object p2, Lorg/webrtc/VideoCodecStatus;->OK:Lorg/webrtc/VideoCodecStatus; if-eq p1, p2, :cond_a iget-object p0, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuilders:Ljava/util/concurrent/BlockingDeque; .line 388 invoke-interface {p0}, Ljava/util/concurrent/BlockingDeque;->pollLast()Ljava/lang/Object; :cond_a return-object p1 .end method .method protected fillInputBuffer(Ljava/nio/ByteBuffer;Lorg/webrtc/VideoFrame$Buffer;)V .locals 0 iget-object p0, p0, Lorg/webrtc/HardwareVideoEncoder;->yuvFormat:Lorg/webrtc/HardwareVideoEncoder$YuvFormat; .line 650 invoke-virtual {p0, p1, p2}, Lorg/webrtc/HardwareVideoEncoder$YuvFormat;->fillBuffer(Ljava/nio/ByteBuffer;Lorg/webrtc/VideoFrame$Buffer;)V return-void .end method .method public getImplementationName()Ljava/lang/String; .locals 0 const-string p0, "HWEncoder" return-object p0 .end method .method public getScalingSettings()Lorg/webrtc/VideoEncoder$ScalingSettings; .locals 2 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 465 invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V iget-boolean v0, p0, Lorg/webrtc/HardwareVideoEncoder;->automaticResizeOn:Z if-eqz v0, :cond_1 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->codecType:Lorg/webrtc/VideoCodecMimeType; .line 467 sget-object v1, Lorg/webrtc/VideoCodecMimeType;->VP8:Lorg/webrtc/VideoCodecMimeType; if-ne v0, v1, :cond_0 .line 470 new-instance p0, Lorg/webrtc/VideoEncoder$ScalingSettings; const/16 v0, 0x1d const/16 v1, 0x5f invoke-direct {p0, v0, v1}, Lorg/webrtc/VideoEncoder$ScalingSettings;->(II)V return-object p0 :cond_0 iget-object p0, p0, Lorg/webrtc/HardwareVideoEncoder;->codecType:Lorg/webrtc/VideoCodecMimeType; .line 471 sget-object v0, Lorg/webrtc/VideoCodecMimeType;->H264:Lorg/webrtc/VideoCodecMimeType; if-ne p0, v0, :cond_1 .line 474 new-instance p0, Lorg/webrtc/VideoEncoder$ScalingSettings; const/16 v0, 0x18 const/16 v1, 0x25 invoke-direct {p0, v0, v1}, Lorg/webrtc/VideoEncoder$ScalingSettings;->(II)V return-object p0 .line 477 :cond_1 sget-object p0, Lorg/webrtc/VideoEncoder$ScalingSettings;->OFF:Lorg/webrtc/VideoEncoder$ScalingSettings; return-object p0 .end method .method public initEncode(Lorg/webrtc/VideoEncoder$Settings;Lorg/webrtc/VideoEncoder$Callback;)Lorg/webrtc/VideoCodecStatus; .locals 2 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 204 invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V iput-object p2, p0, Lorg/webrtc/HardwareVideoEncoder;->callback:Lorg/webrtc/VideoEncoder$Callback; .line 207 iget-boolean p2, p1, Lorg/webrtc/VideoEncoder$Settings;->automaticResizeOn:Z iput-boolean p2, p0, Lorg/webrtc/HardwareVideoEncoder;->automaticResizeOn:Z .line 208 iget p2, p1, Lorg/webrtc/VideoEncoder$Settings;->width:I iput p2, p0, Lorg/webrtc/HardwareVideoEncoder;->width:I .line 209 iget p2, p1, Lorg/webrtc/VideoEncoder$Settings;->height:I iput p2, p0, Lorg/webrtc/HardwareVideoEncoder;->height:I .line 210 invoke-direct {p0}, Lorg/webrtc/HardwareVideoEncoder;->canUseSurface()Z move-result p2 iput-boolean p2, p0, Lorg/webrtc/HardwareVideoEncoder;->useSurfaceMode:Z .line 212 iget p2, p1, Lorg/webrtc/VideoEncoder$Settings;->startBitrate:I if-eqz p2, :cond_0 iget p2, p1, Lorg/webrtc/VideoEncoder$Settings;->maxFramerate:I if-eqz p2, :cond_0 iget-object p2, p0, Lorg/webrtc/HardwareVideoEncoder;->bitrateAdjuster:Lorg/webrtc/BitrateAdjuster; .line 213 iget v0, p1, Lorg/webrtc/VideoEncoder$Settings;->startBitrate:I mul-int/lit16 v0, v0, 0x3e8 iget v1, p1, Lorg/webrtc/VideoEncoder$Settings;->maxFramerate:I invoke-interface {p2, v0, v1}, Lorg/webrtc/BitrateAdjuster;->setTargets(II)V :cond_0 iget-object p2, p0, Lorg/webrtc/HardwareVideoEncoder;->bitrateAdjuster:Lorg/webrtc/BitrateAdjuster; .line 215 invoke-interface {p2}, Lorg/webrtc/BitrateAdjuster;->getAdjustedBitrateBps()I move-result p2 iput p2, p0, Lorg/webrtc/HardwareVideoEncoder;->adjustedBitrate:I .line 217 new-instance p2, Ljava/lang/StringBuilder; const-string v0, "initEncode: " invoke-direct {p2, v0}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V iget v0, p0, Lorg/webrtc/HardwareVideoEncoder;->width:I invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object p2 const-string v0, " x " invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p2 iget v0, p0, Lorg/webrtc/HardwareVideoEncoder;->height:I invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object p2 const-string v0, ". @ " invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p2 iget v0, p1, Lorg/webrtc/VideoEncoder$Settings;->startBitrate:I invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object p2 const-string v0, "kbps. Fps: " invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p2 iget p1, p1, Lorg/webrtc/VideoEncoder$Settings;->maxFramerate:I invoke-virtual {p2, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object p1 const-string p2, " Use surface mode: " invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p1 iget-boolean p2, p0, Lorg/webrtc/HardwareVideoEncoder;->useSurfaceMode:Z invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder; move-result-object p1 invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object p1 const-string p2, "HardwareVideoEncoder" invoke-static {p2, p1}, Lorg/webrtc/Logging;->d(Ljava/lang/String;Ljava/lang/String;)V .line 220 invoke-direct {p0}, Lorg/webrtc/HardwareVideoEncoder;->initEncodeInternal()Lorg/webrtc/VideoCodecStatus; move-result-object p0 return-object p0 .end method .method synthetic lambda$deliverEncodedImage$0$org-webrtc-HardwareVideoEncoder(I)V .locals 2 .line 0 :try_start_0 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; const/4 v1, 0x0 .line 592 invoke-interface {v0, p1, v1}, Lorg/webrtc/MediaCodecWrapper;->releaseOutputBuffer(IZ)V :try_end_0 .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0 goto :goto_0 :catch_0 move-exception p1 const-string v0, "HardwareVideoEncoder" const-string v1, "releaseOutputBuffer failed" .line 594 invoke-static {v0, v1, p1}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V :goto_0 iget-object p0, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuffersBusyCount:Lorg/webrtc/HardwareVideoEncoder$BusyCount; .line 596 invoke-virtual {p0}, Lorg/webrtc/HardwareVideoEncoder$BusyCount;->decrement()V return-void .end method .method public release()Lorg/webrtc/VideoCodecStatus; .locals 3 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 288 invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->outputThread:Ljava/lang/Thread; if-nez v0, :cond_0 .line 292 sget-object v0, Lorg/webrtc/VideoCodecStatus;->OK:Lorg/webrtc/VideoCodecStatus; goto :goto_0 :cond_0 const/4 v0, 0x0 iput-boolean v0, p0, Lorg/webrtc/HardwareVideoEncoder;->running:Z iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->outputThread:Ljava/lang/Thread; const-wide/16 v1, 0x1388 .line 296 invoke-static {v0, v1, v2}, Lorg/webrtc/ThreadUtils;->joinUninterruptibly(Ljava/lang/Thread;J)Z move-result v0 const-string v1, "HardwareVideoEncoder" if-nez v0, :cond_1 const-string v0, "Media encoder release timeout" .line 297 invoke-static {v1, v0}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;)V .line 298 sget-object v0, Lorg/webrtc/VideoCodecStatus;->TIMEOUT:Lorg/webrtc/VideoCodecStatus; goto :goto_0 :cond_1 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->shutdownException:Ljava/lang/Exception; if-eqz v0, :cond_2 const-string v0, "Media encoder release exception" iget-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->shutdownException:Ljava/lang/Exception; .line 301 invoke-static {v1, v0, v2}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V .line 302 sget-object v0, Lorg/webrtc/VideoCodecStatus;->ERROR:Lorg/webrtc/VideoCodecStatus; goto :goto_0 .line 304 :cond_2 sget-object v0, Lorg/webrtc/VideoCodecStatus;->OK:Lorg/webrtc/VideoCodecStatus; :goto_0 iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->textureDrawer:Lorg/webrtc/GlRectDrawer; .line 308 invoke-virtual {v1}, Lorg/webrtc/GlRectDrawer;->release()V iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->videoFrameDrawer:Lorg/webrtc/VideoFrameDrawer; .line 309 invoke-virtual {v1}, Lorg/webrtc/VideoFrameDrawer;->release()V iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->textureEglBase:Lorg/webrtc/EglBase14; const/4 v2, 0x0 if-eqz v1, :cond_3 .line 311 invoke-interface {v1}, Lorg/webrtc/EglBase14;->release()V iput-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->textureEglBase:Lorg/webrtc/EglBase14; :cond_3 iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->textureInputSurface:Landroid/view/Surface; if-eqz v1, :cond_4 .line 315 invoke-virtual {v1}, Landroid/view/Surface;->release()V iput-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->textureInputSurface:Landroid/view/Surface; :cond_4 iget-object v1, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuilders:Ljava/util/concurrent/BlockingDeque; .line 318 invoke-interface {v1}, Ljava/util/concurrent/BlockingDeque;->clear()V iput-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->codec:Lorg/webrtc/MediaCodecWrapper; iput-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->outputBuffers:[Ljava/nio/ByteBuffer; iput-object v2, p0, Lorg/webrtc/HardwareVideoEncoder;->outputThread:Ljava/lang/Thread; iget-object p0, p0, Lorg/webrtc/HardwareVideoEncoder;->encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 325 invoke-virtual {p0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->detachThread()V return-object v0 .end method .method public setRateAllocation(Lorg/webrtc/VideoEncoder$BitrateAllocation;I)Lorg/webrtc/VideoCodecStatus; .locals 1 iget-object v0, p0, Lorg/webrtc/HardwareVideoEncoder;->encodeThreadChecker:Lorg/webrtc/ThreadUtils$ThreadChecker; .line 455 invoke-virtual {v0}, Lorg/webrtc/ThreadUtils$ThreadChecker;->checkIsOnValidThread()V const/16 v0, 0x1e if-le p2, v0, :cond_0 move p2, v0 :cond_0 iget-object p0, p0, Lorg/webrtc/HardwareVideoEncoder;->bitrateAdjuster:Lorg/webrtc/BitrateAdjuster; .line 459 invoke-virtual {p1}, Lorg/webrtc/VideoEncoder$BitrateAllocation;->getSum()I move-result p1 invoke-interface {p0, p1, p2}, Lorg/webrtc/BitrateAdjuster;->setTargets(II)V .line 460 sget-object p0, Lorg/webrtc/VideoCodecStatus;->OK:Lorg/webrtc/VideoCodecStatus; return-object p0 .end method