This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/5565 RTP_Emulation: Add RtpemConfig / RTPEM_configure() call Change-Id: Ie60b750fc009a3d8aa044e4fd450873aa19086bb --- M library/RTP_Emulation.ttcn 1 file changed, 27 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/65/5565/1 diff --git a/library/RTP_Emulation.ttcn b/library/RTP_Emulation.ttcn index 10cf683..e55890e 100644 --- a/library/RTP_Emulation.ttcn +++ b/library/RTP_Emulation.ttcn @@ -32,10 +32,7 @@ port RTPEM_CTRL_PT CTRL; /* configurable by user, should be fixed */ - var INT7b g_tx_payload_type := 0; - var integer g_tx_samplerate_hz := 8000; - var integer g_tx_duration_ms := 20; - var BIT32_BO_LAST g_tx_ssrc := hex2bit('DEADBEEF'H); + var RtpemConfig g_cfg := c_default_cfg; var HostName g_remote_host; var PortNumber g_remote_port; @@ -59,12 +56,29 @@ RTPEM_MODE_BIDIR }; +type record RtpemConfig { + INT7b tx_payload_type, + integer tx_samplerate_hz, + integer tx_duration_ms, + BIT32_BO_LAST tx_ssrc, + octetstring tx_fixed_payload optional +}; + +const RtpemConfig c_default_cfg := { + tx_payload_type := 0, + tx_samplerate_hz := 8000, + tx_duration_ms := 20, + tx_ssrc := '11011110101011011011111011101111'B, + tx_fixed_payload := '01020304'O +} + signature RTPEM_bind(in HostName local_host, inout PortNumber local_port); signature RTPEM_connect(in HostName remote_host, in PortNumber remote_port); signature RTPEM_mode(in RtpemMode mode); +signature RTPEM_configure(in RtpemConfig cfg); type port RTPEM_CTRL_PT procedure { - inout RTPEM_bind, RTPEM_connect, RTPEM_mode; + inout RTPEM_bind, RTPEM_connect, RTPEM_mode, RTPEM_configure; } with { extension "internal" }; template PDU_RTP ts_RTP(BIT32_BO_LAST ssrc, INT7b pt, LIN2_BO_LAST seq, uint32_t ts, @@ -84,20 +98,21 @@ } private function f_tx_rtp(octetstring payload, BIT1 marker := '0'B) runs on RTP_Emulation_CT { - var PDU_RTP rtp := valueof(ts_RTP(g_tx_ssrc, g_tx_payload_type, g_tx_next_seq, + var PDU_RTP rtp := valueof(ts_RTP(g_cfg.tx_ssrc, g_cfg.tx_payload_type, g_tx_next_seq, g_tx_next_ts, payload, marker)); RTP.send(t_RTP_Send(g_rtp_conn_id, RTP_messages_union:{rtp:=rtp})); /* increment sequence + timestamp for next transmit */ g_tx_next_seq := g_tx_next_seq + 1; - g_tx_next_ts := g_tx_next_ts + (g_tx_samplerate_hz / (1000 / g_tx_duration_ms)); + g_tx_next_ts := g_tx_next_ts + (g_cfg.tx_samplerate_hz / (1000 / g_cfg.tx_duration_ms)); } function f_main() runs on RTP_Emulation_CT { var Result res; - timer T_transmit := int2float(g_tx_duration_ms)/1000.0; + timer T_transmit := int2float(g_cfg.tx_duration_ms)/1000.0; var RTP_RecvFrom rx_rtp; + var RtpemConfig cfg; var template RTP_RecvFrom tr := { connId := ?, remName := ?, @@ -174,6 +189,9 @@ g_rx_enabled := true; } } + [] CTRL.getcall(RTPEM_configure:{?}) -> param (cfg) { + g_cfg := cfg; + } /* simply ignore any RTTP/RTCP if receiver not enabled */ [g_rx_enabled==false] RTP.receive(tr_rtp) { } @@ -190,7 +208,7 @@ /* transmit if timer has expired */ [] T_transmit.timeout { /* send one RTP frame, re-start timer */ - f_tx_rtp('01020304'O); + f_tx_rtp(g_cfg.tx_fixed_payload); T_transmit.start; } -- To view, visit https://gerrit.osmocom.org/5565 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie60b750fc009a3d8aa044e4fd450873aa19086bb Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Harald Welte <laforge at gnumonks.org>