Skip to content

Commit 79e75c8

Browse files
committed
Address comments
1 parent a07b13f commit 79e75c8

File tree

3 files changed

+59
-38
lines changed

3 files changed

+59
-38
lines changed

.github/workflows/samples.yml

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ jobs:
124124
run: |
125125
# Equivalent to set -x
126126
Set-PSDebug -Trace 1
127-
127+
128128
$env:Path += ';C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Strawberry\c\bin;C:\Program Files\NASM;D:\producer\open-source\local\lib;D:\producer\open-source\local\bin;D:\gstreamer\1.0\msvc_x86_64\bin'
129-
129+
130130
mkdir D:\producer\debug_output
131-
131+
132132
Invoke-WebRequest -Uri https://awsj-iot-handson.s3-ap-northeast-1.amazonaws.com/kvs-workshop/sample.mp4 -OutFile sample.mp4
133133
dir
134134
$exePath = Join-Path $PWD ${{ matrix.sample.name }}.exe
@@ -139,14 +139,14 @@ jobs:
139139
working-directory: ./build/debug_output
140140
run: |
141141
shopt -s nullglob # Ensure globbing works correctly and avoids errors when no files are found
142-
142+
143143
ls -tlrh
144144
mkvfiles=(*.mkv)
145145
if [ ${#mkvfiles[@]} -eq 0 ]; then
146146
echo "No MKV files found in debug_output"
147147
exit 1
148148
fi
149-
149+
150150
for file in "${mkvfiles[@]}"; do
151151
echo "Verifying $file with mkvinfo (verbose and hexdump):"
152152
mkvinfo -v -X "$file"
@@ -171,15 +171,16 @@ jobs:
171171
}
172172
173173
multistream-sample:
174-
name: Multistream sample on Mac
175-
runs-on: macos-13
174+
name: Multistream sample on Ubuntu 22.04
175+
runs-on: ubuntu-latest
176+
container: public.ecr.aws/ubuntu/ubuntu:22.04_stable
176177
timeout-minutes: 30
177178

178179
env:
179180
AWS_KVS_LOG_LEVEL: 2
180181
KVS_DEBUG_DUMP_DATA_FILE_DIR: ${{ github.workspace }}/build/debug_output
181182
GST_PLUGIN_PATH: ${{ github.workspace }}/build
182-
DEBIAN_FRONTEND: noninteractive
183+
KVS_STREAM_NAME_BASE: demo-stream-producer-cpp-ubuntu-22.04-ci-kvs_gstreamer_multistream_sample
183184

184185
permissions:
185186
id-token: write
@@ -191,14 +192,31 @@ jobs:
191192

192193
- name: Install dependencies
193194
run: |
194-
brew install gstreamer log4cplus mkvtoolnix coreutils
195-
brew install --cask docker
195+
apt-get update
196+
apt-get install -y git cmake build-essential pkg-config libssl-dev libcurl4-openssl-dev \
197+
liblog4cplus-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
198+
gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-bad gstreamer1.0-plugins-good \
199+
gstreamer1.0-plugins-ugly gstreamer1.0-tools curl mkvtoolnix libgstrtspserver-1.0
200+
201+
- name: Build GST RTSP Server Test Launch Sample
202+
run: |
203+
set -x
204+
git clone --no-checkout --filter=blob:none --depth=1 -b 1.22 https://gitlab.freedesktop.org/gstreamer/gstreamer.git
205+
cd gstreamer
206+
git sparse-checkout init cone
207+
git sparse-checkout set "subprojects/gst-rtsp-server/examples/test-launch.c"
208+
git checkout
209+
cd subprojects/gst-rtsp-server/examples
210+
gcc -o test-launch test-launch.c `pkg-config --cflags --libs gstreamer-rtsp-server-1.0`
211+
mv ./test-launch $GITHUB_WORKSPACE
212+
cd $GITHUB_WORKSPACE
213+
rm -rf gstreamer
196214
197215
- name: Build samples
198216
run: |
199217
mkdir build && cd build
200218
mkdir -p $KVS_DEBUG_DUMP_DATA_FILE_DIR
201-
cmake .. -DBUILD_GSTREAMER_PLUGIN=ON -DBUILD_DEPENDENCIES=OFF
219+
cmake .. -DBUILD_GSTREAMER_PLUGIN=ON -DBUILD_DEPENDENCIES=OFF -DALIGNED_MEMORY_MODEL=ON
202220
make -j$(nproc)
203221
204222
- name: Configure AWS Credentials
@@ -214,32 +232,32 @@ jobs:
214232
run: |
215233
set -x
216234
217-
open -a /Applications/Docker.app --args --unattended --accept-license
218-
echo "We are waiting for Docker to be up and running. It can take over 2 minutes..."
219-
while ! /Applications/Docker.app/Contents/Resources/bin/docker info &>/dev/null; do sleep 1; done
235+
export PIPELINE_8554="videotestsrc is-live=true \
236+
! textoverlay text=rtsp://127.0.0.1:8554/test \
237+
! video/x-raw,height=480,width=640,framerate=10/1 \
238+
! x264enc tune=zerolatency bitrate=512 key-int-max=25 \
239+
! h264parse \
240+
! rtph264pay name=pay0 pt=96"
241+
export PIPELINE_8555="videotestsrc is-live=true \
242+
! textoverlay text=rtsp://127.0.0.1:8555/test \
243+
! video/x-raw,height=480,width=640,framerate=10/1 \
244+
! x264enc tune=zerolatency bitrate=512 key-int-max=25 \
245+
! h264parse \
246+
! rtph264pay name=pay0 pt=96"
247+
248+
"$GITHUB_WORKSPACE"/test-launch -p 8554 "${PIPELINE_8554}" &
249+
"$GITHUB_WORKSPACE"/test-launch -p 8555 "${PIPELINE_8555}" &
250+
251+
echo "rtsp://127.0.0.1:8554/test" > rtsp-urls.txt
252+
echo "rtsp://127.0.0.1:8555/test" >> rtsp-urls.txt
220253
221-
sudo ln -s ~/.docker/run/docker.sock /var/run/docker.sock
222-
223-
docker run -d --rm -it -e RTSP_PROTOCOLS=tcp -p 8554:8554 bluenviron/mediamtx:latest
224-
docker run -d --rm -it -e RTSP_PROTOCOLS=tcp -p 8555:8554 bluenviron/mediamtx:latest
225-
226-
(
227-
ffmpeg -re -f lavfi -i "testsrc=size=640x480:rate=10" -vcodec libx264 -x264-params keyint=25 -f rtsp rtsp://localhost:8554/mystream
228-
) &
229-
(
230-
ffmpeg -re -f lavfi -i "testsrc=size=640x480:rate=10" -vcodec libx264 -x264-params keyint=25 -f rtsp rtsp://localhost:8555/mystream
231-
) &
232-
233-
echo "rtsp://0.0.0.0:8554/mystream" > rtsp-urls.txt
234-
echo "rtsp://0.0.0.0:8555/mystream" >> rtsp-urls.txt
235-
236254
sleep 10
237-
gst-discoverer-1.0 rtsp://0.0.0.0:8554/mystream
238-
gst-discoverer-1.0 rtsp://0.0.0.0:8555/mystream
239-
255+
gst-discoverer-1.0 "rtsp://127.0.0.1:8554/test"
256+
gst-discoverer-1.0 "rtsp://127.0.0.1:8555/test"
257+
240258
set +e # Disable exit on error for the timeout command
241-
gtimeout --preserve-status --signal=SIGINT --kill-after=15s 30s \
242-
./kvs_gstreamer_multistream_sample demo-stream-producer-cpp-macos-13-ci-kvs_gstreamer_multistream_sample rtsp-urls.txt
259+
timeout --preserve-status --signal=SIGINT --kill-after=15s 30s \
260+
./kvs_gstreamer_multistream_sample "$KVS_STREAM_NAME" rtsp-urls.txt
243261
EXIT_CODE=$?
244262
set -e # Re-enable exit on error
245263
@@ -265,21 +283,22 @@ jobs:
265283
exit 1
266284
fi
267285
286+
# Since there are 2 streams, check for the presence of two different prefixed MKV files
268287
found_0=0
269288
found_1=0
270289
271290
for file in "${mkvfiles[@]}"; do
272-
if [[ "$file" == demo-stream-producer-cpp-macos-13-ci-kvs_gstreamer_multistream_sample_0* ]]; then
291+
if [[ "$file" == `$KVS_STREAM_NAME`_0* ]]; then
273292
found_0=1
274-
elif [[ "$file" == demo-stream-producer-cpp-macos-13-ci-kvs_gstreamer_multistream_sample_1* ]]; then
293+
elif [[ "$file" ==` $KVS_STREAM_NAME`_1* ]]; then
275294
found_1=1
276295
fi
277296
done
278297
279298
if [ $found_0 -eq 0 ] || [ $found_1 -eq 0 ]; then
280299
echo "Expected at least one file starting with each prefix:"
281-
echo " - demo-stream-producer-cpp-macos-13-ci-kvs_gstreamer_multistream_sample_0"
282-
echo " - demo-stream-producer-cpp-macos-13-ci-kvs_gstreamer_multistream_sample_1"
300+
echo " - `$KVS_STREAM_NAME`_0"
301+
echo " - `$KVS_STREAM_NAME`_1"
283302
exit 1
284303
fi
285304

samples/kvs_gstreamer_multistream_sample.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ static GstFlowReturn on_new_sample(GstElement *sink, CustomData *data) {
261261

262262
buffer->pts += data->producer_start_time_map[stream_handle_key] - data->first_pts_map[stream_handle_key];
263263

264+
// Construct a monotonically increasing DTS if GStreamer doesn't provide one
264265
if (!GST_BUFFER_DTS_IS_VALID(buffer)) {
265266
buffer->dts = data->last_dts_map[stream_handle_key] + DEFAULT_FRAME_DURATION_MS * HUNDREDS_OF_NANOS_IN_A_MILLISECOND * DEFAULT_TIME_UNIT_IN_NANOS;
266267
}

src/gstreamer/gstkvssink.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,7 @@ gst_kvs_sink_handle_buffer (GstCollectPads * pads,
13131313
buf->pts = buf->dts;
13141314
}
13151315
} else if (!GST_BUFFER_DTS_IS_VALID(buf)) {
1316+
// Construct a monotonically increasing DTS if GStreamer doesn't provide one
13161317
buf->dts = data->last_dts + DEFAULT_FRAME_DURATION_MS * HUNDREDS_OF_NANOS_IN_A_MILLISECOND * DEFAULT_TIME_UNIT_IN_NANOS;
13171318
}
13181319

0 commit comments

Comments
 (0)