Skip to content

Commit 06dd300

Browse files
committed
enhancement #180: explicit control of video bitrate
1 parent 4f6fcc6 commit 06dd300

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/reachy_mini/media/webrtc_daemon.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def _configure_webrtc(self, pipeline: Gst.Pipeline) -> Gst.Element:
7878
return webrtcsink
7979

8080
def _configure_receiver(self, pipeline: Gst.Pipeline) -> None:
81-
# gst-launch-1.0 udpsrc port=5000 ! "application/x-rtp,media=audio,encoding-name=OPUS,payload=96" ! rtpjitterbuffer ! rtpopusdepay ! opusdec ! queue! audioconvert ! audioresample ! alsasink device=hw:3
8281
udpsrc = Gst.ElementFactory.make("udpsrc")
8382
udpsrc.set_property("port", 5000)
8483
caps = Gst.Caps.from_string(
@@ -141,13 +140,13 @@ def _configure_video(self, pipeline: Gst.Pipeline, webrtcsink: Gst.Element) -> N
141140
v4l2h264enc = Gst.ElementFactory.make("v4l2h264enc")
142141
extra_controls_structure = Gst.Structure.new_empty("extra-controls")
143142
extra_controls_structure.set_value("repeat_sequence_header", 1)
143+
extra_controls_structure.set_value("video_bitrate", 5_000_000)
144144
v4l2h264enc.set_property("extra-controls", extra_controls_structure)
145145
caps_h264 = Gst.Caps.from_string(
146146
"video/x-h264,stream-format=byte-stream,alignment=au,level=(string)4"
147147
)
148148
capsfilter_h264 = Gst.ElementFactory.make("capsfilter")
149149
capsfilter_h264.set_property("caps", caps_h264)
150-
h264parse = Gst.ElementFactory.make("h264parse")
151150

152151
if not all(
153152
[
@@ -156,7 +155,6 @@ def _configure_video(self, pipeline: Gst.Pipeline, webrtcsink: Gst.Element) -> N
156155
queue,
157156
v4l2h264enc,
158157
capsfilter_h264,
159-
h264parse,
160158
]
161159
):
162160
raise RuntimeError("Failed to create GStreamer video elements")
@@ -181,6 +179,7 @@ def _configure_audio(self, pipeline: Gst.Pipeline, webrtcsink: Gst.Element) -> N
181179
audioconvert = Gst.ElementFactory.make("audioconvert")
182180
audioresample = Gst.ElementFactory.make("audioresample")
183181
opusenc = Gst.ElementFactory.make("opusenc")
182+
opusenc.set_property("audio-type", "restricted-lowdelay")
184183
caps = Gst.Caps.from_string("audio/x-opus,channels=1,rate=48000")
185184
capsfilter = Gst.ElementFactory.make("capsfilter")
186185
capsfilter.set_property("caps", caps)

0 commit comments

Comments
 (0)