Skip to content

Commit 76d8a58

Browse files
WIP
1 parent 16ee51a commit 76d8a58

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ turn = "0.7"
8686
## Image/Thumbnail
8787
image = "0.24"
8888

89+
statrs = "0.17.1"
90+
8991
## GSTREAMER
9092
gst = { package = "gstreamer", version = "0.22", features = ["v1_16"] }
9193
gst-app = { package = "gstreamer-app", version = "0.22", features = ["v1_16"] }

src/lib/stream/pipeline/redirect_pipeline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl RedirectPipeline {
7474
"udp" => {
7575
format!(
7676
concat!(
77-
"udpsrc address={address} port={port} close-socket=false auto-multicast=true",
77+
"udpsrc address={address} port={port} close-socket=false auto-multicast=true do-timestamp=true",
7878
" ! application/x-rtp",
7979
" ! tee name={sink_tee_name} allow-not-linked=true"
8080
),

src/lib/stream/pipeline/v4l_pipeline.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ impl V4lPipeline {
9898
concat!(
9999
"v4l2src device={device} do-timestamp=true",
100100
// We don't need a jpegparse, as it leads to incompatible caps, spoiling the negotiation.
101+
// " ! jpegparse", TODO: test it again, it was possibly a gstreamer bug
101102
" ! capsfilter name={filter_name} caps=image/jpeg,width={width},height={height},framerate={interval_denominator}/{interval_numerator}",
102103
" ! tee name={video_tee_name} allow-not-linked=true",
103104
" ! rtpjpegpay pt=96",

src/lib/stream/sink/image_sink.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ impl ImageSink {
346346
match encoding {
347347
VideoEncodeType::H264 => {
348348
// For h264, we need to filter-out unwanted non-key frames here, before decoding it.
349+
// let parser = gst::ElementFactory::make("h264parse").build()?;
349350
let filter = gst::ElementFactory::make("identity")
350351
.property("drop-buffer-flags", gst::BufferFlags::DELTA_UNIT)
351352
.property("sync", false)
@@ -354,12 +355,15 @@ impl ImageSink {
354355
.property_from_str("lowres", "2") // (0) is 'full'; (1) is '1/2-size'; (2) is '1/4-size'
355356
.build()?;
356357
decoder.has_property("discard-corrupted-frames", None).then(|| decoder.set_property("discard-corrupted-frames", true));
358+
// _transcoding_elements.push(parser);
357359
_transcoding_elements.push(filter);
358360
_transcoding_elements.push(decoder);
359361
}
360362
VideoEncodeType::Mjpg => {
363+
// let parser = gst::ElementFactory::make("jpegparse").build()?;
361364
let decoder = gst::ElementFactory::make("jpegdec").build()?;
362365
decoder.has_property("discard-corrupted-frames", None).then(|| decoder.set_property("discard-corrupted-frames", true));
366+
// _transcoding_elements.push(parser);
363367
_transcoding_elements.push(decoder);
364368
}
365369
VideoEncodeType::Rgb => {}

tests/v4l2_latency_and_jitter.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ impl V4l2LoopBack {
6565
unreachable!();
6666
};
6767

68-
let endpoint = video_and_stream_information
69-
.stream_information
70-
.endpoints
71-
.first()
72-
.unwrap();
73-
7468
let pipeline_description = match configuration.encode {
7569
VideoEncodeType::H264 => format!(
7670
concat!(
@@ -186,7 +180,7 @@ impl QrTimeStampSink {
186180
" ! rtph264depay",
187181
" ! h264parse",
188182
" ! video/x-h264,width={width},height={height},framerate={framerate_num}/{framerate_den}",
189-
" ! avdec_h264",
183+
" ! avdec_h264 discard-corrupted-frames=true",
190184
" ! videoconvert",
191185
" ! qrtimestampsink name=qrsink",
192186
),
@@ -311,7 +305,7 @@ impl Baseline {
311305
" ! video/x-h264,profile=constrained-baseline,stream-format=byte-stream,alignment=au",
312306
" ! h264parse",
313307
" ! video/x-h264,width={width},height={height},framerate={framerate_num}/{framerate_den}",
314-
" ! avdec_h264",
308+
" ! avdec_h264 discard-corrupted-frames=true",
315309
" ! videoconvert",
316310
" ! qrtimestampsink name=qrsink",
317311
),
@@ -556,9 +550,9 @@ async fn main() {
556550
let buffers = 100;
557551

558552
let test_cases = [
559-
(VideoEncodeType::H264, format!("udp://{address}:5600"), 5.),
560-
(VideoEncodeType::Mjpg, format!("udp://{address}:5600"), 5.),
561-
(VideoEncodeType::Yuyv, format!("udp://{address}:5600"), 8.),
553+
// (VideoEncodeType::H264, format!("udp://{address}:5600"), 5.),
554+
// (VideoEncodeType::Mjpg, format!("udp://{address}:5600"), 5.),
555+
// (VideoEncodeType::Yuyv, format!("udp://{address}:5600"), 8.),
562556
(
563557
VideoEncodeType::H264,
564558
format!("rtsp://{address}:8554/test"),

0 commit comments

Comments
 (0)