improve Reolink interoperability with new Retina

Attempt at #114 and #144. Let's see how much it helps.
This commit is contained in:
Scott Lamb 2021-08-19 15:06:20 -07:00
parent 6270cc0ee4
commit 5c3c61838f
4 changed files with 14 additions and 6 deletions

View File

@ -13,6 +13,8 @@ Each release is tagged in Git and on the Docker repository
before. before.
* fix [#147](https://github.com/scottlamb/moonfire-nvr/issues/147): confusing * fix [#147](https://github.com/scottlamb/moonfire-nvr/issues/147): confusing
`nvr init` failures when using very old versions of SQLite. `nvr init` failures when using very old versions of SQLite.
* improve compatibility with Reolink cameras when using the default
`--rtsp-library=retina`.
## `v0.6.5` (2021-08-13) ## `v0.6.5` (2021-08-13)

5
server/Cargo.lock generated
View File

@ -1870,9 +1870,8 @@ dependencies = [
[[package]] [[package]]
name = "retina" name = "retina"
version = "0.1.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/scottlamb/retina#6155d4ebcfe61ee92b1e7ebb5525436e89f23bf3"
checksum = "90f1c5358f01c77609ea1b56b86b96ff3b14e2f535bdd51fc214144cf266738b"
dependencies = [ dependencies = [
"base64", "base64",
"bitreader", "bitreader",

View File

@ -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.1.0" retina = { git = "https://github.com/scottlamb/retina" }
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"] }

View File

@ -383,7 +383,14 @@ impl RetinaOpener {
), ),
Error, Error,
> { > {
let mut session = retina::client::Session::describe(url, creds).await?; let mut session = retina::client::Session::describe(
url,
retina::client::SessionOptions::default()
.creds(creds)
.user_agent("Moonfire NVR".to_owned())
.ignore_spurious_data(true), // TODO: make this configurable.
)
.await?;
let (video_i, mut video_params) = session let (video_i, mut video_params) = session
.streams() .streams()
.iter() .iter()
@ -394,7 +401,7 @@ impl RetinaOpener {
}) })
.ok_or_else(|| format_err!("couldn't find H.264 video stream"))?; .ok_or_else(|| format_err!("couldn't find H.264 video stream"))?;
session.setup(video_i).await?; session.setup(video_i).await?;
let session = session.play(retina::client::PlayPolicy::default()).await?; let session = session.play(retina::client::PlayOptions::default()).await?;
let mut session = Box::pin(session.demuxed()?); let mut session = Box::pin(session.demuxed()?);
// First frame. // First frame.