Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
87e170b
feat: add Stream class
Doominika Oct 29, 2025
1603262
feat: implement listStreams method
Doominika Oct 29, 2025
30c624f
feat: add StreamHandle class
Doominika Oct 29, 2025
63b00da
feat: implement createStream method
Doominika Oct 29, 2025
2e34cd1
feat: add DeviceType enum
Doominika Oct 29, 2025
9454287
feat: add MediaDevice class
Doominika Oct 29, 2025
3044b63
feat: implement getMediaDevices method
Doominika Oct 29, 2025
fe01e34
feat:add parser for DeviceType
Doominika Oct 29, 2025
9cfc30f
feat:add parser for MediaDevice
Doominika Oct 29, 2025
ec6cbb2
feat:add parser for StreamHandle
Doominika Oct 29, 2025
c9e9491
feat: change value type in StreamHandle class
Doominika Oct 29, 2025
341ca81
feat: implement addTrack method
Doominika Oct 29, 2025
c6813e1
feat: add nullchecks to addTrack method in jni
Doominika Oct 29, 2025
c1e4d54
feat: implement removeTrack method
Doominika Oct 29, 2025
a418de4
feat: add remoteStreamId class
Doominika Oct 29, 2025
16f9956
feat: implement publishStream method
Doominika Oct 29, 2025
85d498c
feat: implement unpublishStream method
Doominika Oct 29, 2025
d48d807
feat: implement subscribeToRemoteStreams method
Doominika Nov 3, 2025
f25d32d
feat: add StreamSettings
Doominika Nov 3, 2025
29889d0
feat: add Settings
Doominika Nov 3, 2025
0d80b30
feat: add OnFrameCallback
Doominika Nov 3, 2025
e2e28d0
feat: add StreamSubscription
Doominika Nov 3, 2025
aa31b24
feat: add Frame
Doominika Nov 3, 2025
73d4b89
feat: implement modifyRemoteStreamsSubscriptions
Doominika Nov 3, 2025
0fea22f
feat: implement unsubscribeFromRemoteStreams
Doominika Nov 3, 2025
c432217
feat: implement dropBrokenFrames
Doominika Nov 3, 2025
ccc65e1
refactor: remove unnecessary getters
Doominika Dec 1, 2025
b53b906
chore: fix contents of arguments passed to null-check function
Doominika Dec 1, 2025
11a2c6e
feat: add missing null-check
Doominika Dec 1, 2025
8d9b1dc
chore: update OnFrameCallback params names
Doominika Dec 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions privmx-endpoint/src/main/cpp/model_native_initializers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1394,5 +1394,130 @@ namespace privmx {
);
}

//Stream
jobject stream2Java(
JniContextUtils &ctx,
privmx::endpoint::stream::Stream stream_c
) {
jclass itemCls = ctx->FindClass(
"com/simplito/java/privmx_endpoint/model/Stream");

jmethodID initItemMID = ctx->GetMethodID(
itemCls,
"<init>",
"("
"Ljava/lang/Long;" // streamId
"Ljava/lang/String;" // userId
")V"
);

return ctx->NewObject(
itemCls,
initItemMID,
ctx.long2jLong(stream_c.streamId),
ctx->NewStringUTF(stream_c.userId.c_str())
);
}

jobject deviceType2Java(
JniContextUtils &ctx,
privmx::endpoint::stream::DeviceType deviceType_c
) {
jclass itemCls = ctx->FindClass(
"com/simplito/java/privmx_endpoint/model/streams/DeviceType");

jmethodID valuesMID = ctx->GetStaticMethodID(itemCls, "values",
"()[Lcom/simplito/java/privmx_endpoint/model/streams/DeviceType;");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"()[Lcom/simplito/java/privmx_endpoint/model/streams/DeviceType;");
"()Lcom/simplito/java/privmx_endpoint/model/streams/DeviceType;"


jobjectArray enumValues = (jobjectArray) ctx->CallStaticObjectMethod(itemCls,
valuesMID);

return (jobject) ctx->GetObjectArrayElement(enumValues, (int) deviceType_c);
}


jobject mediaDevice2Java(
JniContextUtils &ctx,
privmx::endpoint::stream::MediaDevice mediaDevice_c
) {
jclass itemCls = ctx->FindClass(
"com/simplito/java/privmx_endpoint/model/streams/MediaDevice");

jmethodID initItemMID = ctx->GetMethodID(
itemCls,
"<init>",
"("
"Ljava/lang/String;" // name
"Ljava/lang/String;" // id
"Lcom/simplito/java/privmx_endpoint/model/streams/DeviceType;" // type
")V"
);

return ctx->NewObject(
itemCls,
initItemMID,
ctx->NewStringUTF(mediaDevice_c.name.c_str()),
ctx->NewStringUTF(mediaDevice_c.id.c_str()),
deviceType2Java(ctx, mediaDevice_c.type)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line

);
}

jobject streamHandle2Java(
JniContextUtils &ctx,
privmx::endpoint::stream::StreamHandle streamHandle_c
) {
jclass itemCls = ctx->FindClass(
"com/simplito/java/privmx_endpoint/model/streams/StreamHandle");

jmethodID initItemMID = ctx->GetMethodID(
itemCls,
"<init>",
"("
"Ljava/lang/Long;" // value
")V"
);

return ctx->NewObject(
itemCls,
initItemMID,
ctx.long2jLong(streamHandle_c)
);
}

jobject remoteStreamId2Java(JniContextUtils &ctx, privmx::endpoint::stream::RemoteStreamId remoteStreamId_c){
jclass itemCls = ctx->FindClass(
"com/simplito/java/privmx_endpoint/model/streams/RemoteStreamId");

jmethodID initItemMID = ctx->GetMethodID(
itemCls,
"<init>",
"("
"Ljava/lang/Long;" // value
")V"
);

return ctx->NewObject(
itemCls,
initItemMID,
ctx.long2jLong(remoteStreamId_c)
);
}

jobject frame2Java(JniContextUtils &ctx, privmx::endpoint::stream::Frame &frame_c) {
jclass itemCls = ctx->FindClass(
"com/simplito/java/privmx_endpoint/model/streams/Frame");

jmethodID initItemMID = ctx->GetMethodID(
itemCls,
"<init>",
"()V"
);

return ctx->NewObject(
itemCls,
initItemMID
);
}
} // wrapper
} // privmx
14 changes: 14 additions & 0 deletions privmx-endpoint/src/main/cpp/model_native_initializers.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include "privmx/endpoint/crypto/ExtKey.hpp"
#include "privmx/endpoint/kvdb/KvdbApi.hpp"
#include "privmx/endpoint/kvdb/Types.hpp"
#include "privmx/endpoint/stream/Types.hpp"
#include "privmx/endpoint/stream/webrtc/Types.hpp"

namespace privmx {
namespace wrapper {
Expand Down Expand Up @@ -161,6 +163,18 @@ namespace privmx {

jobject kvdbEntry2Java(JniContextUtils &ctx, privmx::endpoint::kvdb::KvdbEntry entry_c);

//Stream
jobject stream2Java(JniContextUtils &ctx, privmx::endpoint::stream::Stream stream_c);

jobject deviceType2Java(JniContextUtils &ctx,privmx::endpoint::stream::DeviceType deviceType_c);

jobject mediaDevice2Java(JniContextUtils &ctx, privmx::endpoint::stream::MediaDevice mediaDevice_c);

jobject streamHandle2Java(JniContextUtils &ctx, privmx::endpoint::stream::StreamHandle streamHandle_c);

jobject remoteStreamId2Java(JniContextUtils &ctx, privmx::endpoint::stream::RemoteStreamId remoteStreamId_c);

jobject frame2Java(JniContextUtils &ctx, privmx::endpoint::stream::Frame &frame_c);

} // wrapper
} // privmx
Expand Down
Loading