Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

updated videoroom plugin #5

Merged
merged 1 commit into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
public class CustomPluginFactory extends PluginFactory {

@Override
public Plugin create(Protocol owner) {
public Plugin create(long handleId, Protocol owner) {
return new CustomPlugin();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ public void onAnswer(String sdp, Bundle context) {
}

@Override
public void onIceCandidate(String mid, int index, String sdp) {
public void onIceCandidate(String mid, int index, String sdp, long id) {

}

@Override
public void onIceCompleted() {
public void onIceCompleted(long id) {

}

Expand Down
3 changes: 3 additions & 0 deletions generated/cpp/janus/janus_event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include <cstdint>
#include <memory>

namespace Janus {
Expand All @@ -14,6 +15,8 @@ class JanusEvent {
public:
virtual ~JanusEvent() {}

virtual int64_t sender() = 0;

virtual std::shared_ptr<Jsep> jsep() = 0;

virtual std::shared_ptr<JanusData> data() = 0;
Expand Down
3 changes: 2 additions & 1 deletion generated/cpp/janus/plugin_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include <cstdint>
#include <memory>

namespace Janus {
Expand All @@ -14,7 +15,7 @@ class PluginFactory {
public:
virtual ~PluginFactory() {}

virtual std::shared_ptr<Plugin> create(const std::shared_ptr<Protocol> & owner) = 0;
virtual std::shared_ptr<Plugin> create(int64_t handleId, const std::shared_ptr<Protocol> & owner) = 0;
};

} // namespace Janus
4 changes: 2 additions & 2 deletions generated/cpp/janus/protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class Protocol {

virtual void onAnswer(const std::string & sdp, const std::shared_ptr<Bundle> & context) = 0;

virtual void onIceCandidate(const std::string & mid, int32_t index, const std::string & sdp, const std::shared_ptr<Bundle> & context) = 0;
virtual void onIceCandidate(const std::string & mid, int32_t index, const std::string & sdp, int64_t id) = 0;

virtual void onIceCompleted(const std::shared_ptr<Bundle> & context) = 0;
virtual void onIceCompleted(int64_t id) = 0;
};

} // namespace Janus
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.util.concurrent.atomic.AtomicBoolean;

public abstract class JanusEvent {
public abstract long sender();

public abstract Jsep jsep();

public abstract JanusData data();
Expand Down Expand Up @@ -33,6 +35,14 @@ protected void finalize() throws java.lang.Throwable
super.finalize();
}

@Override
public long sender()
{
assert !this.destroyed.get() : "trying to use a destroyed object";
return native_sender(this.nativeRef);
}
private native long native_sender(long _nativeRef);

@Override
public Jsep jsep()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.concurrent.atomic.AtomicBoolean;

public abstract class PluginFactory {
public abstract Plugin create(Protocol owner);
public abstract Plugin create(long handleId, Protocol owner);

private static final class CppProxy extends PluginFactory
{
Expand All @@ -32,11 +32,11 @@ protected void finalize() throws java.lang.Throwable
}

@Override
public Plugin create(Protocol owner)
public Plugin create(long handleId, Protocol owner)
{
assert !this.destroyed.get() : "trying to use a destroyed object";
return native_create(this.nativeRef, owner);
return native_create(this.nativeRef, handleId, owner);
}
private native Plugin native_create(long _nativeRef, Protocol owner);
private native Plugin native_create(long _nativeRef, long handleId, Protocol owner);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public abstract class Protocol {

public abstract void onAnswer(String sdp, Bundle context);

public abstract void onIceCandidate(String mid, int index, String sdp, Bundle context);
public abstract void onIceCandidate(String mid, int index, String sdp, long id);

public abstract void onIceCompleted(Bundle context);
public abstract void onIceCompleted(long id);

private static final class CppProxy extends Protocol
{
Expand Down Expand Up @@ -104,19 +104,19 @@ public void onAnswer(String sdp, Bundle context)
private native void native_onAnswer(long _nativeRef, String sdp, Bundle context);

@Override
public void onIceCandidate(String mid, int index, String sdp, Bundle context)
public void onIceCandidate(String mid, int index, String sdp, long id)
{
assert !this.destroyed.get() : "trying to use a destroyed object";
native_onIceCandidate(this.nativeRef, mid, index, sdp, context);
native_onIceCandidate(this.nativeRef, mid, index, sdp, id);
}
private native void native_onIceCandidate(long _nativeRef, String mid, int index, String sdp, Bundle context);
private native void native_onIceCandidate(long _nativeRef, String mid, int index, String sdp, long id);

@Override
public void onIceCompleted(Bundle context)
public void onIceCompleted(long id)
{
assert !this.destroyed.get() : "trying to use a destroyed object";
native_onIceCompleted(this.nativeRef, context);
native_onIceCompleted(this.nativeRef, id);
}
private native void native_onIceCompleted(long _nativeRef, Bundle context);
private native void native_onIceCompleted(long _nativeRef, long id);
}
}
11 changes: 11 additions & 0 deletions generated/jni/native_janus_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This file generated by Djinni from janus-client.djinni

#include "native_janus_event.hpp" // my header
#include "Marshal.hpp"
#include "native_janus_data.hpp"
#include "native_jsep.hpp"

Expand All @@ -20,6 +21,16 @@ CJNIEXPORT void JNICALL Java_com_github_helloiampau_janus_generated_JanusEvent_0
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}

CJNIEXPORT jlong JNICALL Java_com_github_helloiampau_janus_generated_JanusEvent_00024CppProxy_native_1sender(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::objectFromHandleAddress<::Janus::JanusEvent>(nativeRef);
auto r = ref->sender();
return ::djinni::release(::djinni::I64::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}

CJNIEXPORT jobject JNICALL Java_com_github_helloiampau_janus_generated_JanusEvent_00024CppProxy_native_1jsep(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
Expand Down
9 changes: 6 additions & 3 deletions generated/jni/native_plugin_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This file generated by Djinni from janus-client.djinni

#include "native_plugin_factory.hpp" // my header
#include "Marshal.hpp"
#include "native_plugin.hpp"
#include "native_protocol.hpp"

Expand All @@ -15,11 +16,12 @@ NativePluginFactory::JavaProxy::JavaProxy(JniType j) : Handle(::djinni::jniGetTh

NativePluginFactory::JavaProxy::~JavaProxy() = default;

std::shared_ptr<::Janus::Plugin> NativePluginFactory::JavaProxy::create(const std::shared_ptr<::Janus::Protocol> & c_owner) {
std::shared_ptr<::Janus::Plugin> NativePluginFactory::JavaProxy::create(int64_t c_handleId, const std::shared_ptr<::Janus::Protocol> & c_owner) {
auto jniEnv = ::djinni::jniGetThreadEnv();
::djinni::JniLocalScope jscope(jniEnv, 10);
const auto& data = ::djinni::JniClass<::djinni_generated::NativePluginFactory>::get();
auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_create,
::djinni::get(::djinni::I64::fromCpp(jniEnv, c_handleId)),
::djinni::get(::djinni_generated::NativeProtocol::fromCpp(jniEnv, c_owner)));
::djinni::jniExceptionCheck(jniEnv);
return ::djinni_generated::NativePlugin::toCpp(jniEnv, jret);
Expand All @@ -33,12 +35,13 @@ CJNIEXPORT void JNICALL Java_com_github_helloiampau_janus_generated_PluginFactor
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}

CJNIEXPORT jobject JNICALL Java_com_github_helloiampau_janus_generated_PluginFactory_00024CppProxy_native_1create(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jobject j_owner)
CJNIEXPORT jobject JNICALL Java_com_github_helloiampau_janus_generated_PluginFactory_00024CppProxy_native_1create(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jlong j_handleId, jobject j_owner)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::objectFromHandleAddress<::Janus::PluginFactory>(nativeRef);
auto r = ref->create(::djinni_generated::NativeProtocol::toCpp(jniEnv, j_owner));
auto r = ref->create(::djinni::I64::toCpp(jniEnv, j_handleId),
::djinni_generated::NativeProtocol::toCpp(jniEnv, j_owner));
return ::djinni::release(::djinni_generated::NativePlugin::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
Expand Down
4 changes: 2 additions & 2 deletions generated/jni/native_plugin_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class NativePluginFactory final : ::djinni::JniInterface<::Janus::PluginFactory,
JavaProxy(JniType j);
~JavaProxy();

std::shared_ptr<::Janus::Plugin> create(const std::shared_ptr<::Janus::Protocol> & owner) override;
std::shared_ptr<::Janus::Plugin> create(int64_t handleId, const std::shared_ptr<::Janus::Protocol> & owner) override;

private:
friend ::djinni::JniInterface<::Janus::PluginFactory, ::djinni_generated::NativePluginFactory>;
};

const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/github/helloiampau/janus/generated/PluginFactory") };
const jmethodID method_create { ::djinni::jniGetMethodID(clazz.get(), "create", "(Lcom/github/helloiampau/janus/generated/Protocol;)Lcom/github/helloiampau/janus/generated/Plugin;") };
const jmethodID method_create { ::djinni::jniGetMethodID(clazz.get(), "create", "(JLcom/github/helloiampau/janus/generated/Protocol;)Lcom/github/helloiampau/janus/generated/Plugin;") };
};

} // namespace djinni_generated
16 changes: 8 additions & 8 deletions generated/jni/native_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,23 @@ void NativeProtocol::JavaProxy::onAnswer(const std::string & c_sdp, const std::s
::djinni::get(::djinni_generated::NativeBundle::fromCpp(jniEnv, c_context)));
::djinni::jniExceptionCheck(jniEnv);
}
void NativeProtocol::JavaProxy::onIceCandidate(const std::string & c_mid, int32_t c_index, const std::string & c_sdp, const std::shared_ptr<::Janus::Bundle> & c_context) {
void NativeProtocol::JavaProxy::onIceCandidate(const std::string & c_mid, int32_t c_index, const std::string & c_sdp, int64_t c_id) {
auto jniEnv = ::djinni::jniGetThreadEnv();
::djinni::JniLocalScope jscope(jniEnv, 10);
const auto& data = ::djinni::JniClass<::djinni_generated::NativeProtocol>::get();
jniEnv->CallVoidMethod(Handle::get().get(), data.method_onIceCandidate,
::djinni::get(::djinni::String::fromCpp(jniEnv, c_mid)),
::djinni::get(::djinni::I32::fromCpp(jniEnv, c_index)),
::djinni::get(::djinni::String::fromCpp(jniEnv, c_sdp)),
::djinni::get(::djinni_generated::NativeBundle::fromCpp(jniEnv, c_context)));
::djinni::get(::djinni::I64::fromCpp(jniEnv, c_id)));
::djinni::jniExceptionCheck(jniEnv);
}
void NativeProtocol::JavaProxy::onIceCompleted(const std::shared_ptr<::Janus::Bundle> & c_context) {
void NativeProtocol::JavaProxy::onIceCompleted(int64_t c_id) {
auto jniEnv = ::djinni::jniGetThreadEnv();
::djinni::JniLocalScope jscope(jniEnv, 10);
const auto& data = ::djinni::JniClass<::djinni_generated::NativeProtocol>::get();
jniEnv->CallVoidMethod(Handle::get().get(), data.method_onIceCompleted,
::djinni::get(::djinni_generated::NativeBundle::fromCpp(jniEnv, c_context)));
::djinni::get(::djinni::I64::fromCpp(jniEnv, c_id)));
::djinni::jniExceptionCheck(jniEnv);
}

Expand Down Expand Up @@ -174,24 +174,24 @@ CJNIEXPORT void JNICALL Java_com_github_helloiampau_janus_generated_Protocol_000
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}

CJNIEXPORT void JNICALL Java_com_github_helloiampau_janus_generated_Protocol_00024CppProxy_native_1onIceCandidate(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jstring j_mid, jint j_index, jstring j_sdp, jobject j_context)
CJNIEXPORT void JNICALL Java_com_github_helloiampau_janus_generated_Protocol_00024CppProxy_native_1onIceCandidate(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jstring j_mid, jint j_index, jstring j_sdp, jlong j_id)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::objectFromHandleAddress<::Janus::Protocol>(nativeRef);
ref->onIceCandidate(::djinni::String::toCpp(jniEnv, j_mid),
::djinni::I32::toCpp(jniEnv, j_index),
::djinni::String::toCpp(jniEnv, j_sdp),
::djinni_generated::NativeBundle::toCpp(jniEnv, j_context));
::djinni::I64::toCpp(jniEnv, j_id));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}

CJNIEXPORT void JNICALL Java_com_github_helloiampau_janus_generated_Protocol_00024CppProxy_native_1onIceCompleted(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jobject j_context)
CJNIEXPORT void JNICALL Java_com_github_helloiampau_janus_generated_Protocol_00024CppProxy_native_1onIceCompleted(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jlong j_id)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::objectFromHandleAddress<::Janus::Protocol>(nativeRef);
ref->onIceCompleted(::djinni_generated::NativeBundle::toCpp(jniEnv, j_context));
ref->onIceCompleted(::djinni::I64::toCpp(jniEnv, j_id));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}

Expand Down
8 changes: 4 additions & 4 deletions generated/jni/native_protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class NativeProtocol final : ::djinni::JniInterface<::Janus::Protocol, NativePro
void close() override;
void onOffer(const std::string & sdp, const std::shared_ptr<::Janus::Bundle> & context) override;
void onAnswer(const std::string & sdp, const std::shared_ptr<::Janus::Bundle> & context) override;
void onIceCandidate(const std::string & mid, int32_t index, const std::string & sdp, const std::shared_ptr<::Janus::Bundle> & context) override;
void onIceCompleted(const std::shared_ptr<::Janus::Bundle> & context) override;
void onIceCandidate(const std::string & mid, int32_t index, const std::string & sdp, int64_t id) override;
void onIceCompleted(int64_t id) override;

private:
friend ::djinni::JniInterface<::Janus::Protocol, ::djinni_generated::NativeProtocol>;
Expand All @@ -55,8 +55,8 @@ class NativeProtocol final : ::djinni::JniInterface<::Janus::Protocol, NativePro
const jmethodID method_close { ::djinni::jniGetMethodID(clazz.get(), "close", "()V") };
const jmethodID method_onOffer { ::djinni::jniGetMethodID(clazz.get(), "onOffer", "(Ljava/lang/String;Lcom/github/helloiampau/janus/generated/Bundle;)V") };
const jmethodID method_onAnswer { ::djinni::jniGetMethodID(clazz.get(), "onAnswer", "(Ljava/lang/String;Lcom/github/helloiampau/janus/generated/Bundle;)V") };
const jmethodID method_onIceCandidate { ::djinni::jniGetMethodID(clazz.get(), "onIceCandidate", "(Ljava/lang/String;ILjava/lang/String;Lcom/github/helloiampau/janus/generated/Bundle;)V") };
const jmethodID method_onIceCompleted { ::djinni::jniGetMethodID(clazz.get(), "onIceCompleted", "(Lcom/github/helloiampau/janus/generated/Bundle;)V") };
const jmethodID method_onIceCandidate { ::djinni::jniGetMethodID(clazz.get(), "onIceCandidate", "(Ljava/lang/String;ILjava/lang/String;J)V") };
const jmethodID method_onIceCompleted { ::djinni::jniGetMethodID(clazz.get(), "onIceCompleted", "(J)V") };
};

} // namespace djinni_generated
2 changes: 2 additions & 0 deletions generated/objc/JanusJanusEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

@interface JanusJanusEvent : NSObject

- (int64_t)sender;

- (nullable JanusJsep *)jsep;

- (nullable JanusJanusData *)data;
Expand Down
3 changes: 2 additions & 1 deletion generated/objc/JanusPluginFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@protocol JanusPluginFactory

- (nullable id<JanusPlugin>)create:(nullable id<JanusProtocol>)owner;
- (nullable id<JanusPlugin>)create:(int64_t)handleId
owner:(nullable id<JanusProtocol>)owner;

@end
4 changes: 2 additions & 2 deletions generated/objc/JanusProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
- (void)onIceCandidate:(nonnull NSString *)mid
index:(int32_t)index
sdp:(nonnull NSString *)sdp
context:(nullable JanusBundle *)context;
id:(int64_t)id;

- (void)onIceCompleted:(nullable JanusBundle *)context;
- (void)onIceCompleted:(int64_t)id;

@end
8 changes: 8 additions & 0 deletions generated/objcpp/JanusJanusEvent+Private.mm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#import "JanusJanusEvent.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
#import "JanusJanusData+Private.h"
#import "JanusJsep+Private.h"
#include <exception>
Expand All @@ -31,6 +32,13 @@ - (id)initWithCpp:(const std::shared_ptr<::Janus::JanusEvent>&)cppRef
return self;
}

- (int64_t)sender {
try {
auto objcpp_result_ = _cppRefHandle.get()->sender();
return ::djinni::I64::fromCpp(objcpp_result_);
} DJINNI_TRANSLATE_EXCEPTIONS()
}

- (nullable JanusJsep *)jsep {
try {
auto objcpp_result_ = _cppRefHandle.get()->jsep();
Expand Down
Loading