fix gstreamer tests

This commit is contained in:
aler9
2020-12-17 12:59:08 +01:00
parent 9e8715d4ad
commit 9a602f77f7
3 changed files with 14 additions and 3 deletions

View File

@@ -294,11 +294,13 @@ func TestServerPublishReadTCP(t *testing.T) {
case "gstreamer": case "gstreamer":
cnt1, err := newContainer("gstreamer", "publish", []string{ cnt1, err := newContainer("gstreamer", "publish", []string{
"filesrc location=emptyvideo.ts ! tsdemux ! queue ! video/x-h264 ! h264parse config-interval=1 ! rtspclientsink " + "filesrc location=emptyvideo.ts ! tsdemux ! video/x-h264 ! rtspclientsink " +
"location=" + proto + "://127.0.0.1:8554/teststream protocols=tcp tls-validation-flags=0 latency=0 timeout=0 rtx-time=0", "location=" + proto + "://127.0.0.1:8554/teststream protocols=tcp tls-validation-flags=0 latency=0 timeout=0 rtx-time=0",
}) })
require.NoError(t, err) require.NoError(t, err)
defer cnt1.close() defer cnt1.close()
time.Sleep(1 * time.Second)
} }
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)

View File

@@ -195,6 +195,15 @@ func (sc *ServerConn) backgroundRead(handlers ServerConnReadHandlers, done chan
}, fmt.Errorf("transport header: %s", err) }, fmt.Errorf("transport header: %s", err)
} }
// workaround to prevent a bug in rtspclientsink
// that makes impossible for the client to receive the response
// and send frames.
// this was causing problems during unit tests.
if ua, ok := req.Header["User-Agent"]; ok && len(ua) == 1 &&
strings.HasPrefix(ua[0], "GStreamer") {
time.Sleep(1 * time.Second)
}
return handlers.OnSetup(req, th) return handlers.OnSetup(req, th)
} }

View File

@@ -1,5 +1,5 @@
###################################### ######################################
FROM ubuntu:20.04 AS exitafterframe FROM ubuntu:20.04 AS build
RUN apt update && apt install -y --no-install-recommends \ RUN apt update && apt install -y --no-install-recommends \
pkg-config \ pkg-config \
@@ -36,7 +36,7 @@ RUN apt update && apt install -y --no-install-recommends \
gstreamer1.0-libav \ gstreamer1.0-libav \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY --from=exitafterframe /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libexitafterframe.so /usr/lib/x86_64-linux-gnu/gstreamer-1.0/ COPY --from=build /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libexitafterframe.so /usr/lib/x86_64-linux-gnu/gstreamer-1.0/
COPY emptyvideo.ts / COPY emptyvideo.ts /