package org.webrtc; import java.nio.ByteBuffer; import java.util.concurrent.TimeUnit; /* loaded from: classes3.dex */ public class EncodedImage implements RefCounted { public final ByteBuffer buffer; public final long captureTimeMs; public final long captureTimeNs; public final int encodedHeight; public final int encodedWidth; public final FrameType frameType; public final Integer qp; private final RefCountDelegate refCountDelegate; public final int rotation; private ByteBuffer getBuffer() { return this.buffer; } private long getCaptureTimeNs() { return this.captureTimeNs; } private int getEncodedHeight() { return this.encodedHeight; } private int getEncodedWidth() { return this.encodedWidth; } private Integer getQp() { return this.qp; } private int getRotation() { return this.rotation; } /* loaded from: classes3.dex */ public enum FrameType { EmptyFrame(0), VideoFrameKey(3), VideoFrameDelta(4); private final int nativeIndex; public int getNative() { return this.nativeIndex; } FrameType(int i) { this.nativeIndex = i; } static FrameType fromNativeIndex(int i) { for (FrameType frameType : values()) { if (frameType.getNative() == i) { return frameType; } } throw new IllegalArgumentException("Unknown native frame type: " + i); } } @Override // org.webrtc.RefCounted public void retain() { this.refCountDelegate.retain(); } @Override // org.webrtc.RefCounted public void release() { this.refCountDelegate.release(); } private EncodedImage(ByteBuffer byteBuffer, Runnable runnable, int i, int i2, long j, FrameType frameType, int i3, Integer num) { this.buffer = byteBuffer; this.encodedWidth = i; this.encodedHeight = i2; this.captureTimeMs = TimeUnit.NANOSECONDS.toMillis(j); this.captureTimeNs = j; this.frameType = frameType; this.rotation = i3; this.qp = num; this.refCountDelegate = new RefCountDelegate(runnable); } private int getFrameType() { return this.frameType.getNative(); } public static Builder builder() { return new Builder(); } /* loaded from: classes3.dex */ public static class Builder { private ByteBuffer buffer; private long captureTimeNs; private int encodedHeight; private int encodedWidth; private FrameType frameType; private Integer qp; private Runnable releaseCallback; private int rotation; public Builder setBuffer(ByteBuffer byteBuffer, Runnable runnable) { this.buffer = byteBuffer; this.releaseCallback = runnable; return this; } public Builder setCaptureTimeNs(long j) { this.captureTimeNs = j; return this; } public Builder setEncodedHeight(int i) { this.encodedHeight = i; return this; } public Builder setEncodedWidth(int i) { this.encodedWidth = i; return this; } public Builder setFrameType(FrameType frameType) { this.frameType = frameType; return this; } public Builder setQp(Integer num) { this.qp = num; return this; } public Builder setRotation(int i) { this.rotation = i; return this; } private Builder() { } @Deprecated public Builder setCaptureTimeMs(long j) { this.captureTimeNs = TimeUnit.MILLISECONDS.toNanos(j); return this; } public EncodedImage createEncodedImage() { return new EncodedImage(this.buffer, this.releaseCallback, this.encodedWidth, this.encodedHeight, this.captureTimeNs, this.frameType, this.rotation, this.qp); } } }