244 lines
6 KiB
Smali
244 lines
6 KiB
Smali
.class public Lorg/webrtc/VideoTrack;
|
|
.super Lorg/webrtc/MediaStreamTrack;
|
|
.source "VideoTrack.java"
|
|
|
|
|
|
# annotations
|
|
.annotation runtime Lorg/webrtc/JNINamespace;
|
|
value = "webrtc::jni"
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field private final renderers:Ljava/util/List;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/List<",
|
|
"Lorg/webrtc/VideoRenderer;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private final sinks:Ljava/util/IdentityHashMap;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/IdentityHashMap<",
|
|
"Lorg/webrtc/VideoSink;",
|
|
"Ljava/lang/Long;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(J)V
|
|
.locals 0
|
|
|
|
invoke-direct {p0, p1, p2}, Lorg/webrtc/MediaStreamTrack;-><init>(J)V
|
|
|
|
new-instance p1, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {p1}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
iput-object p1, p0, Lorg/webrtc/VideoTrack;->renderers:Ljava/util/List;
|
|
|
|
new-instance p1, Ljava/util/IdentityHashMap;
|
|
|
|
invoke-direct {p1}, Ljava/util/IdentityHashMap;-><init>()V
|
|
|
|
iput-object p1, p0, Lorg/webrtc/VideoTrack;->sinks:Ljava/util/IdentityHashMap;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private static native nativeAddSink(JJ)V
|
|
.end method
|
|
|
|
.method private static native nativeFreeSink(J)V
|
|
.end method
|
|
|
|
.method private static native nativeRemoveSink(JJ)V
|
|
.end method
|
|
|
|
.method private static native nativeWrapSink(Lorg/webrtc/VideoSink;)J
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public addRenderer(Lorg/webrtc/VideoRenderer;)V
|
|
.locals 4
|
|
|
|
iget-object v0, p0, Lorg/webrtc/VideoTrack;->renderers:Ljava/util/List;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
iget-wide v0, p0, Lorg/webrtc/VideoTrack;->nativeTrack:J
|
|
|
|
iget-wide v2, p1, Lorg/webrtc/VideoRenderer;->nativeVideoRenderer:J
|
|
|
|
invoke-static {v0, v1, v2, v3}, Lorg/webrtc/VideoTrack;->nativeAddSink(JJ)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public addSink(Lorg/webrtc/VideoSink;)V
|
|
.locals 4
|
|
|
|
invoke-static {p1}, Lorg/webrtc/VideoTrack;->nativeWrapSink(Lorg/webrtc/VideoSink;)J
|
|
|
|
move-result-wide v0
|
|
|
|
iget-object v2, p0, Lorg/webrtc/VideoTrack;->sinks:Ljava/util/IdentityHashMap;
|
|
|
|
invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v2, p1, v3}, Ljava/util/IdentityHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
iget-wide v2, p0, Lorg/webrtc/VideoTrack;->nativeTrack:J
|
|
|
|
invoke-static {v2, v3, v0, v1}, Lorg/webrtc/VideoTrack;->nativeAddSink(JJ)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public dispose()V
|
|
.locals 6
|
|
|
|
iget-object v0, p0, Lorg/webrtc/VideoTrack;->renderers:Ljava/util/List;
|
|
|
|
invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v0
|
|
|
|
:goto_0
|
|
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Lorg/webrtc/VideoRenderer;
|
|
|
|
iget-wide v2, p0, Lorg/webrtc/VideoTrack;->nativeTrack:J
|
|
|
|
iget-wide v4, v1, Lorg/webrtc/VideoRenderer;->nativeVideoRenderer:J
|
|
|
|
invoke-static {v2, v3, v4, v5}, Lorg/webrtc/VideoTrack;->nativeRemoveSink(JJ)V
|
|
|
|
invoke-virtual {v1}, Lorg/webrtc/VideoRenderer;->dispose()V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
iget-object v0, p0, Lorg/webrtc/VideoTrack;->renderers:Ljava/util/List;
|
|
|
|
invoke-interface {v0}, Ljava/util/List;->clear()V
|
|
|
|
iget-object v0, p0, Lorg/webrtc/VideoTrack;->sinks:Ljava/util/IdentityHashMap;
|
|
|
|
invoke-virtual {v0}, Ljava/util/IdentityHashMap;->values()Ljava/util/Collection;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-interface {v0}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v0
|
|
|
|
:goto_1
|
|
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Ljava/lang/Long;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide v1
|
|
|
|
iget-wide v3, p0, Lorg/webrtc/VideoTrack;->nativeTrack:J
|
|
|
|
invoke-static {v3, v4, v1, v2}, Lorg/webrtc/VideoTrack;->nativeRemoveSink(JJ)V
|
|
|
|
invoke-static {v1, v2}, Lorg/webrtc/VideoTrack;->nativeFreeSink(J)V
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
iget-object v0, p0, Lorg/webrtc/VideoTrack;->sinks:Ljava/util/IdentityHashMap;
|
|
|
|
invoke-virtual {v0}, Ljava/util/IdentityHashMap;->clear()V
|
|
|
|
invoke-super {p0}, Lorg/webrtc/MediaStreamTrack;->dispose()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public removeRenderer(Lorg/webrtc/VideoRenderer;)V
|
|
.locals 4
|
|
|
|
iget-object v0, p0, Lorg/webrtc/VideoTrack;->renderers:Ljava/util/List;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
iget-wide v0, p0, Lorg/webrtc/VideoTrack;->nativeTrack:J
|
|
|
|
iget-wide v2, p1, Lorg/webrtc/VideoRenderer;->nativeVideoRenderer:J
|
|
|
|
invoke-static {v0, v1, v2, v3}, Lorg/webrtc/VideoTrack;->nativeRemoveSink(JJ)V
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoRenderer;->dispose()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public removeSink(Lorg/webrtc/VideoSink;)V
|
|
.locals 4
|
|
|
|
iget-object v0, p0, Lorg/webrtc/VideoTrack;->sinks:Ljava/util/IdentityHashMap;
|
|
|
|
invoke-virtual {v0, p1}, Ljava/util/IdentityHashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Ljava/lang/Long;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide v0
|
|
|
|
const-wide/16 v2, 0x0
|
|
|
|
cmp-long p1, v0, v2
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
iget-wide v2, p0, Lorg/webrtc/VideoTrack;->nativeTrack:J
|
|
|
|
invoke-static {v2, v3, v0, v1}, Lorg/webrtc/VideoTrack;->nativeRemoveSink(JJ)V
|
|
|
|
invoke-static {v0, v1}, Lorg/webrtc/VideoTrack;->nativeFreeSink(J)V
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|