spscream
spscream
SMSoftware Mansion
Created by spscream on 4/14/2024 in #membrane-help
terminate part of pipeline children
hi, I have the following: ParticipantPipeline with multiple children: - :vr_publisher - :vr_subscriber - :vr_screen_subscriber - :vr_screen_publisher they are custom bins containing logic to work with webrtc connections to janus gateway. I need to shutdown :vr_screen_publisher, when someone publishes screen media to janus room. Goal is to have only one screen publish to the room at a time. How to properly handle this situation?
2 replies
SMSoftware Mansion
Created by spscream on 3/15/2024 in #membrane-help
bundlex nifs and libasan
Is it anyone build nifs with libasan support? Even if I put compiler_flags ["-fno-omit-frame-pointer -fsanitize=address"] it doesn't detect leaks I intentionally left in nif code. I run elixir with ERL_EXEC="cerl" and set -asan option for vm and erlang is running with address_sanitizer flag.
2 replies
SMSoftware Mansion
Created by spscream on 3/11/2024 in #membrane-help
unifex seg fault on handle_destroy_state
Hi, i'm implementing g772.1 decoder/encoder plugin and have issue with handle_destroy state. I've taken freeswitch g7221 implementation(https://github.com/traviscross/freeswitch/tree/master/libs/libg722_1/src). I have the following state:
#pragma once
#include <g722_1.h>

typedef struct State State;

struct State {
g722_1_decode_state_t *decode_state;
};

#include "_generated/decoder.h"
#pragma once
#include <g722_1.h>

typedef struct State State;

struct State {
g722_1_decode_state_t *decode_state;
};

#include "_generated/decoder.h"
and added following handle_destroy_state callback:
void handle_destroy_state(UnifexEnv *env, State *state) {
UNIFEX_UNUSED(env);

if (state->decode_state != NULL) {
g722_1_decode_release(state->decode_state);
}
}
void handle_destroy_state(UnifexEnv *env, State *state) {
UNIFEX_UNUSED(env);

if (state->decode_state != NULL) {
g722_1_decode_release(state->decode_state);
}
}
but it causes segmentation fault. g7221_1_decode_release calls free on passed pointer. Implementation of g722_1_decode_release:
int g722_1_decode_release(g722_1_decode_state_t *s)
{
free(s);
return 0;
}
int g722_1_decode_release(g722_1_decode_state_t *s)
{
free(s);
return 0;
}
Is it state freed by unifex itself?
8 replies
SMSoftware Mansion
Created by spscream on 3/7/2024 in #membrane-help
toilet capacity of outbound_rtx_controller
Hi, I'm getting the following error on SessionBin:
[error] <0.1282.0>/:sip_rtp/{:outbound_rtx_controller, 1929338881} Toilet overflow.

Atomic demand reached the size of -201, which means that there are 201
...
You can also try changing the `toilet_capacity` in `Membrane.ChildrenSpec.via_in/3`.

[error] <0.1282.0>/ Terminating with reason: {:membrane_child_crash, :sip_video, :killed}
[error] <0.1282.0>/:sip_rtp/{:outbound_rtx_controller, 1929338881} Toilet overflow.

Atomic demand reached the size of -201, which means that there are 201
...
You can also try changing the `toilet_capacity` in `Membrane.ChildrenSpec.via_in/3`.

[error] <0.1282.0>/ Terminating with reason: {:membrane_child_crash, :sip_video, :killed}
sip_rtp is SessionBin with following inputs for video:
child(:sip_video, %UDP.Endpoint{
local_port_no: src_video_port,
local_address: opts.server_ip,
destination_port_no: video_port,
destination_address: video_dst
})
|> via_in(:rtp_input)
|> get_child(:sip_rtp),
child(:sip_video_rtcp, %UDP.Endpoint{
local_port_no: src_video_port + 1,
local_address: opts.server_ip,
destination_port_no: video_port + 1,
destination_address: video_dst
})
|> via_in(:rtp_input)
|> get_child(:sip_rtp),
child(:sip_video, %UDP.Endpoint{
local_port_no: src_video_port,
local_address: opts.server_ip,
destination_port_no: video_port,
destination_address: video_dst
})
|> via_in(:rtp_input)
|> get_child(:sip_rtp),
child(:sip_video_rtcp, %UDP.Endpoint{
local_port_no: src_video_port + 1,
local_address: opts.server_ip,
destination_port_no: video_port + 1,
destination_address: video_dst
})
|> via_in(:rtp_input)
|> get_child(:sip_rtp),
and has following output for video:
@impl true
def handle_child_notification({:video_vr_subscriber, ssrc}, _src, _ctx, state) do
spec = {[
get_child(:video_vr_subscriber)
|> via_out(Pad.ref(:output, ssrc))
|> child(:h264_encoder, %Membrane.H264.FFmpeg.Encoder{...})
|> child(:h264_parser, %Membrane.H264.Parser{...})
|> via_in(Pad.ref(:input, state.video_ssrc), options: [
payloader: %RTP.H264.Payloader{...}
])
|> get_child(:sip_rtp)
|> via_out(Pad.ref(:rtp_output, state.video_ssrc), options: [encoding: :H264, payload_type: 109])
|> via_in(Pad.ref(:input))
|> get_child(:sip_video),
], stream_sync: :sinks}

{[spec: spec], state}
end
@impl true
def handle_child_notification({:video_vr_subscriber, ssrc}, _src, _ctx, state) do
spec = {[
get_child(:video_vr_subscriber)
|> via_out(Pad.ref(:output, ssrc))
|> child(:h264_encoder, %Membrane.H264.FFmpeg.Encoder{...})
|> child(:h264_parser, %Membrane.H264.Parser{...})
|> via_in(Pad.ref(:input, state.video_ssrc), options: [
payloader: %RTP.H264.Payloader{...}
])
|> get_child(:sip_rtp)
|> via_out(Pad.ref(:rtp_output, state.video_ssrc), options: [encoding: :H264, payload_type: 109])
|> via_in(Pad.ref(:input))
|> get_child(:sip_video),
], stream_sync: :sinks}

{[spec: spec], state}
end
How can I debug cause of this?
9 replies
SMSoftware Mansion
Created by spscream on 3/5/2024 in #membrane-help
h264 encoder problems
hi guys, I'm using h264 encoder plugin for video encoding and sending it via rtp to client. Sometimes video play on client speeds up or speeds down. How to debug such cases and what could be a reason of such lagging video? Network issues? input for encoder is coming from webrtc source
15 replies