mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-01-24 13:13:16 -05:00
upgrade to retina 0.0.3
The new version is more efficient.
This commit is contained in:
parent
9cb19d5c82
commit
4c95df5ba7
10
server/Cargo.lock
generated
10
server/Cargo.lock
generated
@ -1,5 +1,7 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "addr2line"
|
name = "addr2line"
|
||||||
version = "0.15.1"
|
version = "0.15.1"
|
||||||
@ -1874,9 +1876,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "retina"
|
name = "retina"
|
||||||
version = "0.0.1"
|
version = "0.0.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3ac613fa999c0d1075a825705e01ab302f7bab09410ed8df5d65a63eb9e922da"
|
checksum = "151ca8320bb2fb48dc29a9106b7e6fcde088720cb7895b3a3aacac7e09faa68b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-stream",
|
"async-stream",
|
||||||
"base64",
|
"base64",
|
||||||
@ -1950,9 +1952,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rtp-rs"
|
name = "rtp-rs"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e1110d695193d446e901de09921ffbf2d86ae351bbfde9c5b53863ce177e17f5"
|
checksum = "d4ed274a5b3d36c4434cff6a4de1b42f43e64ae326b1cfa72d13d9037a314355"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rtsp-types"
|
name = "rtsp-types"
|
||||||
|
@ -46,7 +46,7 @@ nom = "6.0.0"
|
|||||||
parking_lot = { version = "0.11.1", features = [] }
|
parking_lot = { version = "0.11.1", features = [] }
|
||||||
protobuf = { git = "https://github.com/stepancheg/rust-protobuf" }
|
protobuf = { git = "https://github.com/stepancheg/rust-protobuf" }
|
||||||
reffers = "0.6.0"
|
reffers = "0.6.0"
|
||||||
retina = "0.0.1"
|
retina = "0.0.3"
|
||||||
ring = "0.16.2"
|
ring = "0.16.2"
|
||||||
rusqlite = "0.25.3"
|
rusqlite = "0.25.3"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception.
|
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception.
|
||||||
|
|
||||||
use crate::h264;
|
use crate::h264;
|
||||||
use bytes::Buf;
|
|
||||||
use cstr::cstr;
|
use cstr::cstr;
|
||||||
use failure::format_err;
|
use failure::format_err;
|
||||||
use failure::{bail, Error};
|
use failure::{bail, Error};
|
||||||
@ -386,7 +385,7 @@ impl Opener for RetinaOpener {
|
|||||||
)?;
|
)?;
|
||||||
let stream = Box::new(RetinaStream {
|
let stream = Box::new(RetinaStream {
|
||||||
frame_rx,
|
frame_rx,
|
||||||
data: Vec::new(),
|
frame: None,
|
||||||
});
|
});
|
||||||
Ok((extra_data, stream))
|
Ok((extra_data, stream))
|
||||||
}
|
}
|
||||||
@ -420,27 +419,23 @@ impl RetinaOpener {
|
|||||||
|
|
||||||
struct RetinaStream {
|
struct RetinaStream {
|
||||||
frame_rx: tokio::sync::mpsc::Receiver<Result<retina::codec::VideoFrame, Error>>,
|
frame_rx: tokio::sync::mpsc::Receiver<Result<retina::codec::VideoFrame, Error>>,
|
||||||
data: Vec<u8>,
|
frame: Option<retina::codec::VideoFrame>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Stream for RetinaStream {
|
impl Stream for RetinaStream {
|
||||||
fn next(&mut self) -> Result<VideoFrame, Error> {
|
fn next(&mut self) -> Result<VideoFrame, Error> {
|
||||||
let mut frame = self
|
// TODO: use Option::insert after bumping MSRV to 1.53.
|
||||||
.frame_rx
|
self.frame = Some(
|
||||||
.blocking_recv()
|
self.frame_rx
|
||||||
.ok_or_else(|| format_err!("stream ended"))??;
|
.blocking_recv()
|
||||||
self.data.clear();
|
.ok_or_else(|| format_err!("stream ended"))??,
|
||||||
while frame.has_remaining() {
|
);
|
||||||
let chunk = frame.chunk();
|
let frame = self.frame.as_ref().unwrap();
|
||||||
self.data.extend_from_slice(chunk);
|
|
||||||
let len = chunk.len();
|
|
||||||
frame.advance(len);
|
|
||||||
}
|
|
||||||
Ok(VideoFrame {
|
Ok(VideoFrame {
|
||||||
pts: frame.timestamp.elapsed(),
|
pts: frame.timestamp.elapsed(),
|
||||||
duration: 0,
|
duration: 0,
|
||||||
is_key: frame.is_random_access_point,
|
is_key: frame.is_random_access_point,
|
||||||
data: &self.data,
|
data: &frame.data()[..],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user