Skip to content

Commit

Permalink
Expose FrameDispatchCoordinator (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
harryz2000 authored Jul 3, 2024
1 parent 6900ce9 commit d9496a6
Show file tree
Hide file tree
Showing 5 changed files with 408 additions and 45 deletions.
2 changes: 2 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
"<(medooze_media_server_src)/src/avcdescriptor.cpp",
"<(medooze_media_server_src)/src/MediaFrameListenerBridge.cpp",
"<(medooze_media_server_src)/src/rtp/LayerInfo.cpp",
"<(medooze_media_server_src)/src/FrameDelayCalculator.cpp",
"<(medooze_media_server_src)/src/FrameDispatchCoordinator.cpp",
"<(medooze_media_server_src)/src/rtp/RTPPacket.cpp",
"<(medooze_media_server_src)/src/rtp/RTPPayload.cpp",
"<(medooze_media_server_src)/src/rtp/RTPHeader.cpp",
Expand Down
32 changes: 32 additions & 0 deletions src/FrameDispatchCoordinator.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
%{
#include "FrameDispatchCoordinator.h"
%}

class FrameDispatchCoordinator
{
public:

%extend
{
void SetMaxDelayMs(uint32_t maxDelayMs)
{
self->SetMaxDelayMs(std::chrono::milliseconds(maxDelayMs));
}
}
};

SHARED_PTR_BEGIN(FrameDispatchCoordinator)
{
FrameDispatchCoordinatorShared(int aUpdateRefsPacketLateThresholdMs, int aUpdateRefsStepPacketEarlyMs)
{
return new std::shared_ptr<FrameDispatchCoordinator>(
new FrameDispatchCoordinator(aUpdateRefsPacketLateThresholdMs,
std::chrono::milliseconds(aUpdateRefsStepPacketEarlyMs)));
}

FrameDispatchCoordinatorShared()
{
return new std::shared_ptr<FrameDispatchCoordinator>(new FrameDispatchCoordinator());
}
}
SHARED_PTR_END(FrameDispatchCoordinator)
2 changes: 2 additions & 0 deletions src/MediaFrameListenerBridge.i
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
%include "RTPReceiver.i"
%include "MediaFrame.i"
%include "RTMPServerModule.i"
%include "FrameDispatchCoordinator.i"

%nodefaultctor MediaFrameListenerBridge;
struct MediaFrameListenerBridge :
Expand Down Expand Up @@ -45,6 +46,7 @@ struct MediaFrameListenerBridge :

void SetTargetBitrateHint(uint32_t targetBitrateHint);

void SetFrameDispatchCoordinator(const FrameDispatchCoordinatorShared& coordinator);
%extend
{
// Note: Extra const on right of pointer to let SWIG know this only wants a get accessor
Expand Down
15 changes: 15 additions & 0 deletions src/rtmp-server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,19 @@ export class RTMPServerModule {
constructor();
}


export class FrameDispatchCoordinator {
SetMaxDelayMs(maxDelayMs: number): void;
}

export class FrameDispatchCoordinatorShared {

constructor();

get(): FrameDispatchCoordinator;
}


export class MediaFrameListenerBridge extends RTPIncomingMediaStream {

constructor(timeService: TimeService | EventLoop, ssrc: number);
Expand Down Expand Up @@ -287,6 +300,8 @@ export class MediaFrameListenerBridge extends RTPIncomingMediaStream {
RemoveMediaListener(listener: MediaFrameListenerShared): void;

SetTargetBitrateHint(targetBitrateHint: number): void;

SetFrameDispatchCoordinator(coordinator: FrameDispatchCoordinatorShared): void;

codec: string;

Expand Down
Loading

0 comments on commit d9496a6

Please sign in to comment.