527 lines
13 KiB
Smali
527 lines
13 KiB
Smali
.class public Lorg/webrtc/MediaStream;
|
|
.super Ljava/lang/Object;
|
|
.source "MediaStream.java"
|
|
|
|
|
|
# static fields
|
|
.field public static final TAG:Ljava/lang/String; = "MediaStream"
|
|
|
|
|
|
# instance fields
|
|
.field public final audioTracks:Ljava/util/List;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/List<",
|
|
"Lorg/webrtc/AudioTrack;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field public nativeStream:J
|
|
|
|
.field public final preservedVideoTracks:Ljava/util/List;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/List<",
|
|
"Lorg/webrtc/VideoTrack;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field public final videoTracks:Ljava/util/List;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/List<",
|
|
"Lorg/webrtc/VideoTrack;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(J)V
|
|
.locals 1
|
|
.annotation build Lorg/webrtc/CalledByNative;
|
|
.end annotation
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
iput-object v0, p0, Lorg/webrtc/MediaStream;->audioTracks:Ljava/util/List;
|
|
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
iput-object v0, p0, Lorg/webrtc/MediaStream;->videoTracks:Ljava/util/List;
|
|
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
iput-object v0, p0, Lorg/webrtc/MediaStream;->preservedVideoTracks:Ljava/util/List;
|
|
|
|
iput-wide p1, p0, Lorg/webrtc/MediaStream;->nativeStream:J
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private checkMediaStreamExists()V
|
|
.locals 5
|
|
|
|
iget-wide v0, p0, Lorg/webrtc/MediaStream;->nativeStream:J
|
|
|
|
const-wide/16 v2, 0x0
|
|
|
|
cmp-long v4, v0, v2
|
|
|
|
if-eqz v4, :cond_0
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
new-instance v0, Ljava/lang/IllegalStateException;
|
|
|
|
const-string v1, "MediaStream has been disposed."
|
|
|
|
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static native nativeAddAudioTrackToNativeStream(JJ)Z
|
|
.end method
|
|
|
|
.method public static native nativeAddVideoTrackToNativeStream(JJ)Z
|
|
.end method
|
|
|
|
.method public static native nativeGetId(J)Ljava/lang/String;
|
|
.end method
|
|
|
|
.method public static native nativeRemoveAudioTrack(JJ)Z
|
|
.end method
|
|
|
|
.method public static native nativeRemoveVideoTrack(JJ)Z
|
|
.end method
|
|
|
|
.method public static removeMediaStreamTrack(Ljava/util/List;J)V
|
|
.locals 4
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/List<",
|
|
"+",
|
|
"Lorg/webrtc/MediaStreamTrack;",
|
|
">;J)V"
|
|
}
|
|
.end annotation
|
|
|
|
invoke-interface {p0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p0
|
|
|
|
:cond_0
|
|
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Lorg/webrtc/MediaStreamTrack;
|
|
|
|
invoke-virtual {v0}, Lorg/webrtc/MediaStreamTrack;->getNativeMediaStreamTrack()J
|
|
|
|
move-result-wide v1
|
|
|
|
cmp-long v3, v1, p1
|
|
|
|
if-nez v3, :cond_0
|
|
|
|
invoke-virtual {v0}, Lorg/webrtc/MediaStreamTrack;->dispose()V
|
|
|
|
invoke-interface {p0}, Ljava/util/Iterator;->remove()V
|
|
|
|
return-void
|
|
|
|
:cond_1
|
|
const-string p0, "MediaStream"
|
|
|
|
const-string p1, "Couldn\'t not find track"
|
|
|
|
invoke-static {p0, p1}, Lorg/webrtc/Logging;->e(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public addNativeAudioTrack(J)V
|
|
.locals 2
|
|
.annotation build Lorg/webrtc/CalledByNative;
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->audioTracks:Ljava/util/List;
|
|
|
|
new-instance v1, Lorg/webrtc/AudioTrack;
|
|
|
|
invoke-direct {v1, p1, p2}, Lorg/webrtc/AudioTrack;-><init>(J)V
|
|
|
|
invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public addNativeVideoTrack(J)V
|
|
.locals 2
|
|
.annotation build Lorg/webrtc/CalledByNative;
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->videoTracks:Ljava/util/List;
|
|
|
|
new-instance v1, Lorg/webrtc/VideoTrack;
|
|
|
|
invoke-direct {v1, p1, p2}, Lorg/webrtc/VideoTrack;-><init>(J)V
|
|
|
|
invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public addPreservedTrack(Lorg/webrtc/VideoTrack;)Z
|
|
.locals 4
|
|
|
|
invoke-direct {p0}, Lorg/webrtc/MediaStream;->checkMediaStreamExists()V
|
|
|
|
iget-wide v0, p0, Lorg/webrtc/MediaStream;->nativeStream:J
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoTrack;->getNativeVideoTrack()J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-static {v0, v1, v2, v3}, Lorg/webrtc/MediaStream;->nativeAddVideoTrackToNativeStream(JJ)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->preservedVideoTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
const/4 p1, 0x1
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public addTrack(Lorg/webrtc/AudioTrack;)Z
|
|
.locals 4
|
|
|
|
invoke-direct {p0}, Lorg/webrtc/MediaStream;->checkMediaStreamExists()V
|
|
|
|
iget-wide v0, p0, Lorg/webrtc/MediaStream;->nativeStream:J
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/AudioTrack;->getNativeAudioTrack()J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-static {v0, v1, v2, v3}, Lorg/webrtc/MediaStream;->nativeAddAudioTrackToNativeStream(JJ)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->audioTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
const/4 p1, 0x1
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public addTrack(Lorg/webrtc/VideoTrack;)Z
|
|
.locals 4
|
|
|
|
invoke-direct {p0}, Lorg/webrtc/MediaStream;->checkMediaStreamExists()V
|
|
|
|
iget-wide v0, p0, Lorg/webrtc/MediaStream;->nativeStream:J
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoTrack;->getNativeVideoTrack()J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-static {v0, v1, v2, v3}, Lorg/webrtc/MediaStream;->nativeAddVideoTrackToNativeStream(JJ)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->videoTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
const/4 p1, 0x1
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public dispose()V
|
|
.locals 2
|
|
.annotation build Lorg/webrtc/CalledByNative;
|
|
.end annotation
|
|
|
|
invoke-direct {p0}, Lorg/webrtc/MediaStream;->checkMediaStreamExists()V
|
|
|
|
:goto_0
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->audioTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->audioTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Lorg/webrtc/AudioTrack;
|
|
|
|
invoke-virtual {p0, v0}, Lorg/webrtc/MediaStream;->removeTrack(Lorg/webrtc/AudioTrack;)Z
|
|
|
|
invoke-virtual {v0}, Lorg/webrtc/MediaStreamTrack;->dispose()V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
:goto_1
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->videoTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->videoTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Lorg/webrtc/VideoTrack;
|
|
|
|
invoke-virtual {p0, v0}, Lorg/webrtc/MediaStream;->removeTrack(Lorg/webrtc/VideoTrack;)Z
|
|
|
|
invoke-virtual {v0}, Lorg/webrtc/VideoTrack;->dispose()V
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
:goto_2
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->preservedVideoTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_2
|
|
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->preservedVideoTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Lorg/webrtc/VideoTrack;
|
|
|
|
invoke-virtual {p0, v0}, Lorg/webrtc/MediaStream;->removeTrack(Lorg/webrtc/VideoTrack;)Z
|
|
|
|
goto :goto_2
|
|
|
|
:cond_2
|
|
iget-wide v0, p0, Lorg/webrtc/MediaStream;->nativeStream:J
|
|
|
|
invoke-static {v0, v1}, Lorg/webrtc/JniCommon;->nativeReleaseRef(J)V
|
|
|
|
const-wide/16 v0, 0x0
|
|
|
|
iput-wide v0, p0, Lorg/webrtc/MediaStream;->nativeStream:J
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public getId()Ljava/lang/String;
|
|
.locals 2
|
|
|
|
invoke-direct {p0}, Lorg/webrtc/MediaStream;->checkMediaStreamExists()V
|
|
|
|
iget-wide v0, p0, Lorg/webrtc/MediaStream;->nativeStream:J
|
|
|
|
invoke-static {v0, v1}, Lorg/webrtc/MediaStream;->nativeGetId(J)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public getNativeMediaStream()J
|
|
.locals 2
|
|
|
|
invoke-direct {p0}, Lorg/webrtc/MediaStream;->checkMediaStreamExists()V
|
|
|
|
iget-wide v0, p0, Lorg/webrtc/MediaStream;->nativeStream:J
|
|
|
|
return-wide v0
|
|
.end method
|
|
|
|
.method public removeAudioTrack(J)V
|
|
.locals 1
|
|
.annotation build Lorg/webrtc/CalledByNative;
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->audioTracks:Ljava/util/List;
|
|
|
|
invoke-static {v0, p1, p2}, Lorg/webrtc/MediaStream;->removeMediaStreamTrack(Ljava/util/List;J)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public removeTrack(Lorg/webrtc/AudioTrack;)Z
|
|
.locals 4
|
|
|
|
invoke-direct {p0}, Lorg/webrtc/MediaStream;->checkMediaStreamExists()V
|
|
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->audioTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z
|
|
|
|
iget-wide v0, p0, Lorg/webrtc/MediaStream;->nativeStream:J
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/AudioTrack;->getNativeAudioTrack()J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-static {v0, v1, v2, v3}, Lorg/webrtc/MediaStream;->nativeRemoveAudioTrack(JJ)Z
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public removeTrack(Lorg/webrtc/VideoTrack;)Z
|
|
.locals 4
|
|
|
|
invoke-direct {p0}, Lorg/webrtc/MediaStream;->checkMediaStreamExists()V
|
|
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->videoTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z
|
|
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->preservedVideoTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z
|
|
|
|
iget-wide v0, p0, Lorg/webrtc/MediaStream;->nativeStream:J
|
|
|
|
invoke-virtual {p1}, Lorg/webrtc/VideoTrack;->getNativeVideoTrack()J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-static {v0, v1, v2, v3}, Lorg/webrtc/MediaStream;->nativeRemoveVideoTrack(JJ)Z
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public removeVideoTrack(J)V
|
|
.locals 1
|
|
.annotation build Lorg/webrtc/CalledByNative;
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Lorg/webrtc/MediaStream;->videoTracks:Ljava/util/List;
|
|
|
|
invoke-static {v0, p1, p2}, Lorg/webrtc/MediaStream;->removeMediaStreamTrack(Ljava/util/List;J)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public toString()Ljava/lang/String;
|
|
.locals 2
|
|
|
|
const-string v0, "["
|
|
|
|
invoke-static {v0}, Le/e/b/a/a;->a(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0}, Lorg/webrtc/MediaStream;->getId()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v1, ":A="
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
iget-object v1, p0, Lorg/webrtc/MediaStream;->audioTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v1}, Ljava/util/List;->size()I
|
|
|
|
move-result v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
const-string v1, ":V="
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
iget-object v1, p0, Lorg/webrtc/MediaStream;->videoTracks:Ljava/util/List;
|
|
|
|
invoke-interface {v1}, Ljava/util/List;->size()I
|
|
|
|
move-result v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
const-string v1, "]"
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|