mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-28 22:41:02 +00:00
reqwesthttpsrc: Allow a server error after a seek
There might be a server error because a seek would immediately close the old connection without allowing for clean shutdown. Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/527 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1861>
This commit is contained in:
parent
50a48f4b85
commit
3e040c65f1
1 changed files with 9 additions and 4 deletions
|
@ -254,11 +254,16 @@ impl Harness {
|
||||||
fn wait_for_segment(
|
fn wait_for_segment(
|
||||||
&mut self,
|
&mut self,
|
||||||
allow_buffer: bool,
|
allow_buffer: bool,
|
||||||
|
mut allow_server_error: bool,
|
||||||
) -> gst::FormattedSegment<gst::format::Bytes> {
|
) -> gst::FormattedSegment<gst::format::Bytes> {
|
||||||
loop {
|
loop {
|
||||||
match self.receiver.as_mut().unwrap().recv().unwrap() {
|
match self.receiver.as_mut().unwrap().recv().unwrap() {
|
||||||
Message::ServerError(err) => {
|
Message::ServerError(err) => {
|
||||||
panic!("Got server error: {err}");
|
if allow_server_error {
|
||||||
|
allow_server_error = false;
|
||||||
|
} else {
|
||||||
|
panic!("Got server error: {err}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Message::Event(ev) => {
|
Message::Event(ev) => {
|
||||||
use gst::EventView;
|
use gst::EventView;
|
||||||
|
@ -939,7 +944,7 @@ fn test_seek_after_ready() {
|
||||||
src.set_state(gst::State::Playing).unwrap();
|
src.set_state(gst::State::Playing).unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
let segment = h.wait_for_segment(false);
|
let segment = h.wait_for_segment(false, true);
|
||||||
assert_eq!(segment.start(), Some(123.bytes()));
|
assert_eq!(segment.start(), Some(123.bytes()));
|
||||||
|
|
||||||
let mut expected_output = vec![0; 8192 - 123];
|
let mut expected_output = vec![0; 8192 - 123];
|
||||||
|
@ -1015,7 +1020,7 @@ fn test_seek_after_buffer_received() {
|
||||||
src.seek_simple(gst::SeekFlags::FLUSH, 123.bytes()).unwrap();
|
src.seek_simple(gst::SeekFlags::FLUSH, 123.bytes()).unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
let segment = h.wait_for_segment(true);
|
let segment = h.wait_for_segment(true, true);
|
||||||
assert_eq!(segment.start(), Some(123.bytes()));
|
assert_eq!(segment.start(), Some(123.bytes()));
|
||||||
|
|
||||||
let mut expected_output = vec![0; 8192 - 123];
|
let mut expected_output = vec![0; 8192 - 123];
|
||||||
|
@ -1101,7 +1106,7 @@ fn test_seek_with_stop_position() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
let segment = h.wait_for_segment(true);
|
let segment = h.wait_for_segment(true, true);
|
||||||
assert_eq!(segment.start(), Some(start));
|
assert_eq!(segment.start(), Some(start));
|
||||||
assert_eq!(segment.stop(), Some(stop));
|
assert_eq!(segment.stop(), Some(stop));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue