[PATCH 1/2] contrib/rtp: Enhance RTP replay tool

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/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Fri Dec 13 12:18:19 UTC 2013


This patch adds optional parameters to pass the state file, the
destination address (default 127.0.0.1), the destination port
(default 4000), the source port (default 0). So it is called as
follows:

    gst rtp_replay.st -a [FILE [HOST [SOURCEPORT [DESTPORT]]]]

In addition, nonexistant FILEs are no longer created but opened
read-only instead.

Sponsored-by: On-Waves ehf
---
 openbsc/contrib/rtp/rtp_replay.st        |   10 +++++++---
 openbsc/contrib/rtp/rtp_replay_shared.st |   14 ++++++++++++--
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/openbsc/contrib/rtp/rtp_replay.st b/openbsc/contrib/rtp/rtp_replay.st
index 7fa9a4c..e26d073 100644
--- a/openbsc/contrib/rtp/rtp_replay.st
+++ b/openbsc/contrib/rtp/rtp_replay.st
@@ -7,11 +7,15 @@ FileStream fileIn: 'rtp_replay_shared.st'.
 
 
 Eval [
-    | replay |
+    | replay file host dport |
 
+    file := Smalltalk arguments at: 1 ifAbsent: [ 'rtpstream.state' ].
+    host := Smalltalk arguments at: 2 ifAbsent: [ '127.0.0.1' ].
+    dport := (Smalltalk arguments at: 3 ifAbsent: [ '4000' ]) asInteger.
+    sport := (Smalltalk arguments at: 4 ifAbsent: [ '0' ]) asInteger.
 
-    replay := RTPReplay on: Smalltalk arguments first.
+    replay := RTPReplay on: file fromPort: sport.
 
     Transcript nextPutAll: 'Going to stream now'; nl.
-    replay streamAudio: '127.0.0.1' port: 4000.
+    replay streamAudio: host port: dport.
 ]
diff --git a/openbsc/contrib/rtp/rtp_replay_shared.st b/openbsc/contrib/rtp/rtp_replay_shared.st
index dd32aed..7b68c0f 100644
--- a/openbsc/contrib/rtp/rtp_replay_shared.st
+++ b/openbsc/contrib/rtp/rtp_replay_shared.st
@@ -42,8 +42,18 @@ Object subclass: RTPReplay [
             file: aFile; yourself
     ]
 
+    RTPReplay class >> on: aFile fromPort: aPort [
+        ^ self new
+            initialize: aPort;
+            file: aFile; yourself
+    ]
+
     initialize [
-        socket := Sockets.DatagramSocket new.
+        self initialize: 0.
+    ]
+
+    initialize: aPort [
+        socket := Sockets.DatagramSocket local: '0.0.0.0' port: aPort.
     ]
 
     file: aFile [ 
@@ -59,7 +69,7 @@ Object subclass: RTPReplay [
 
         last_time := nil.
         last_image := nil.
-        file := FileStream open: filename.
+        file := FileStream open: filename mode: #read.
 
         "Send the payload"
         dest := Sockets.SocketAddress byName: aHost.
-- 
1.7.9.5





More information about the OpenBSC mailing list