Adding support for the video broadcaster to trace his followers

This commit is contained in:
WolverinDEV 2021-04-26 15:14:09 +02:00
parent 89f4ed05b2
commit bc2c951dde
5 changed files with 49 additions and 8 deletions

@ -1 +1 @@
Subproject commit 50c0265be2f44dff2225d8e8a9c29514c95263c2
Subproject commit 64a573cbd0f890907d4416c87021092e8cce7367

2
rtclib

@ -1 +1 @@
Subproject commit ea2dd197d26330850dfef795cf7db140d26194d7
Subproject commit 1079698605b08b508c8d44c9cf9108f60ba292f2

View File

@ -222,7 +222,7 @@ target_link_libraries(PermMapHelper
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "5")
SET(CPACK_PACKAGE_VERSION_PATCH "4")
SET(CPACK_PACKAGE_VERSION_PATCH "5")
if (BUILD_TYPE_NAME EQUAL OFF)
SET(CPACK_PACKAGE_VERSION_DATA "beta")
elseif (BUILD_TYPE_NAME STREQUAL "")

View File

@ -27,6 +27,9 @@ struct NativeCallbacks {
void(*client_stream_start)(const void* /* callback data */, uint32_t /* stream id */, const void* /* source callback data */);
void(*client_stream_stop)(const void* /* callback data */, uint32_t /* stream id */, const void* /* source callback data */);
void(*client_video_join)(const void* /* callback data */, uint32_t /* stream id */, const void* /* source callback data */);
void(*client_video_leave)(const void* /* callback data */, uint32_t /* stream id */, const void* /* source callback data */);
void(*client_video_broadcast_info)(const void* const* /* callback data array */, uint32_t /* callback data length */, const BroadcastInfo* /* broadcasts */, uint32_t /* broadcast count */);
void(*client_audio_sender_data)(const void* /* callback data */, const void* /* source callback data */, uint8_t /* mode */, uint16_t /* seq. no. */, uint8_t /* codec */, const void* /* data */, uint32_t /* length */);

View File

@ -167,7 +167,7 @@ void librtc_callback_client_ice_candidate(const void* callback_data_ptr, uint32_
target_client->sendCommand(notify);
}
void librtc_callback_client_audio_start(const void* callback_data_ptr, uint32_t stream_id, const void* source_data_ptr) {
void librtc_callback_client_stream_start(const void* callback_data_ptr, uint32_t stream_id, const void* source_data_ptr) {
auto callback_data = (LibCallbackData*) callback_data_ptr;
auto source_data = (LibCallbackData*) source_data_ptr;
@ -222,7 +222,7 @@ void librtc_callback_client_video_broadcast_info(const void* const* callback_dat
}
}
void librtc_callback_client_audio_stop(const void* callback_data_ptr, uint32_t stream_id, const void* source_data_ptr) {
void librtc_callback_client_stream_stop(const void* callback_data_ptr, uint32_t stream_id, const void* source_data_ptr) {
auto callback_data = (LibCallbackData*) callback_data_ptr;
auto source_data = (LibCallbackData*) source_data_ptr;
@ -279,8 +279,43 @@ void librtc_client_whisper_session_reset(const void* callback_data_ptr) {
client->sendCommand(notify);
}
void librtc_callback_client_video_join(const void* callback_data_ptr, uint32_t stream_id, const void* target_data_ptr) {
auto callback_data = (LibCallbackData*) callback_data_ptr;
auto target_data = (LibCallbackData*) target_data_ptr;
auto stream_client = callback_data->weak_ref.lock();
if(!stream_client) { return; }
auto target_client = target_data->weak_ref.lock();
if(!target_client) { return; }
ts::command_builder notify{"notifystreamjoined"};
notify.put_unchecked(0, "streamid", stream_id);
notify.put_unchecked(0, "clid", target_client->getClientId());
notify.put_unchecked(0, "cluid", target_client->getUid());
notify.put_unchecked(0, "cldbid", target_client->getClientDatabaseId());
notify.put_unchecked(0, "clname", target_client->getDisplayName());
stream_client->sendCommand(notify);
}
void librtc_callback_client_video_leave(const void* callback_data_ptr, uint32_t stream_id, const void* target_data_ptr) {
auto callback_data = (LibCallbackData*) callback_data_ptr;
auto target_data = (LibCallbackData*) target_data_ptr;
auto stream_client = callback_data->weak_ref.lock();
if(!stream_client) { return; }
auto target_client = target_data->weak_ref.lock();
if(!target_client) { return; }
ts::command_builder notify{"notifystreamleft"};
notify.put_unchecked(0, "streamid", stream_id);
notify.put_unchecked(0, "clid", target_client->getClientId());
stream_client->sendCommand(notify);
}
static NativeCallbacks native_callbacks{
.version = 6,
.version = 7,
.log = librtc_callback_log,
.free_client_data = librtc_callback_free_client_data,
@ -291,8 +326,11 @@ static NativeCallbacks native_callbacks{
.client_offer_generated = librtc_callback_client_offer_generated,
.client_ice_candidate = librtc_callback_client_ice_candidate,
.client_stream_start = librtc_callback_client_audio_start,
.client_stream_stop = librtc_callback_client_audio_stop,
.client_stream_start = librtc_callback_client_stream_start,
.client_stream_stop = librtc_callback_client_stream_stop,
.client_video_join = librtc_callback_client_video_join,
.client_video_leave = librtc_callback_client_video_leave,
.client_video_broadcast_info = librtc_callback_client_video_broadcast_info,