Commit Graph

65 Commits

Author SHA1 Message Date
Scott Lamb 6ca9f451c2 update retina to 0.3.7
Notably, this includes scottlamb/retina#50, which fixes a panic
parsing the DESCRIBE response sent by some cameras. Should improve #192.
2022-01-28 22:49:41 -08:00
Scott Lamb 9b241c80dc update retina and http-serve deps
* new retina notably fixes #184
* new http-serve removes an accidental debug print on stdout
2021-12-29 22:16:21 -08:00
Scott Lamb 981cee0706 revert cursive upgrade
SelectView::set_selection doesn't seem to be working properly. The
symptom is editing an existing camera will clear the sample file dir,
and thus hitting edit without making any changes will fail.
2021-10-27 14:27:10 -07:00
Scott Lamb 504f1a36ab switch from libpasta to just scrypt
This drops several older dependencies and reduces final binary size
(text section by ~200KiB, unstripped binary by ~12MiB)

I'll have to manually add new hash formats, and I won't ever be able
to take advantage of libpasta's (currently unused) facility to wrap
hashes, but I think it's worth it. libpasta isn't well-maintained.
2021-10-27 11:50:55 -07:00
Scott Lamb a899ba0290 upgrade cursive
This gets rid of a couple redundant dependency versions like ahash.
2021-10-27 10:25:39 -07:00
Scott Lamb 4f22cf66e3 switch from prettydiff to diff
prettydiff has a weird chain of dependencies starting with
prettytable-rs and ending up with (among other things) argon2rs.
2021-10-27 10:20:53 -07:00
Scott Lamb e5707f6557 update some Rust deps
In particular, retina 0.3.4 no longer pulls in an old nom.
2021-10-26 21:41:03 -07:00
Scott Lamb ddda01e4fa preparing v0.7.0 2021-10-26 18:54:26 -07:00
Scott Lamb 4a7f22723c Merge branch 'master' into new-schema 2021-10-21 12:26:31 -07:00
Scott Lamb 9c708ec557 cargo update, rusqlite major version bump 2021-10-20 18:09:16 -07:00
Scott Lamb 985f6e675f prepare v0.6.7 w/ Retina v0.3.3
This improves authentication over RTSP.
2021-10-20 14:59:33 -07:00
Scott Lamb 8da5c4aa56 update various Rust deps 2021-10-02 08:31:04 -07:00
Scott Lamb 095417bb20 Retina 0.3.2, better TEARDOWNs 2021-09-29 05:56:20 -07:00
Scott Lamb 0c0c0692f3 prepare version 0.6.6 2021-09-23 20:02:31 -07:00
Scott Lamb b41a6c43da shutdown better
After a frustrating search for a suitable channel to use for shutdown
(tokio::sync::Receiver and
futures::future::Shared<tokio::sync::oneshot::Receiver> didn't look
quite right) in which I rethought my life decisions, I finally just made
my own (server/base/shutdown.rs). We can easily poll it or wait for it
in async or sync contexts. Most importantly, it's convenient; not that
it really matters here, but it's also efficient.

We now do a slightly better job of propagating a "graceful" shutdown
signal, and this channel will give us tools to improve it over time.

* Shut down even when writer or syncer operations are stuck. Fixes #117
* Not done yet: streamers should instantly shut down without waiting for
  a connection attempt or frame or something. I'll probably
  implement that when removing --rtsp-library=ffmpeg. The code should be
  cleaner then.
* Not done yet: fix a couple places that sleep for up to a second when
  they could shut down immediately. I just need to do the plumbing for
  mock clocks to work.

I also implemented an immediate shutdown mode, activated by a second
signal. I think this will mitigate the streamer wait situation.
2021-09-23 16:33:29 -07:00
Scott Lamb dafd9041d6 json-based config for cameras and streams
for #155

The config interface code for changing cameras is quite messy but
seems to work for now.
2021-09-16 16:13:41 -07:00
Scott Lamb 92f594ef58 handle stale RTSP sessions
* upgrade to Retina 0.3.1 which automatically tears down sessions
* wait out stale sessions before reconnecting
* wait for teardown to complete before shutting down

This adds some pressure on #117: it will keep waiting for the stale
session to expire even if the user has requested shutdown. I'll try
to address that next.
2021-09-09 22:10:45 -07:00
Scott Lamb c42314edb5 UI preferences: #153 #155 2021-09-01 15:08:09 -07:00
Scott Lamb d53450dd3b bump versions of blake3, nom, tokio-tungstenite 2021-08-31 13:05:10 -07:00
Scott Lamb 806d7b6d20 cargo update 2021-08-31 12:59:39 -07:00
Scott Lamb 78bafb01f6 support udp with retina or ffmpeg 2021-08-31 08:11:18 -07:00
Scott Lamb 95dec9791c config: validate more in cameras dialog box
Fixes #152

This won't win any awards for best UI or cleanest UI code, but it's an
improvement. Long-term I want the web config UI instead.
2021-08-23 15:55:47 -07:00
Scott Lamb a16bda8fb1 use retina v0.2.0 2021-08-20 16:52:58 -07:00
Scott Lamb 4892ed77d1 update http-serve to fix erroneous 304
This mostly affects .mp4 init segments (#146), which currently set the
Last-Modified: date to the epoch. It could also affect other resources
(static files, other .mp4 changes) but only if the clock has gone
backwards.
2021-08-19 21:30:47 -07:00
Scott Lamb 5c3c61838f improve Reolink interoperability with new Retina
Attempt at #114 and #144. Let's see how much it helps.
2021-08-19 15:06:20 -07:00
Scott Lamb 711071f003 prepare version 0.6.5 2021-08-13 12:08:19 -07:00
Scott Lamb 42cf77f0d6 upgrade to retina v0.1.0 2021-08-13 11:48:58 -07:00
Scott Lamb 27395ecd4e UI: improve aspect ratio handling
As written in the changelog: Live streams formerly worked around a
Firefox pixel aspect ratio bug by forcing all videos to 16:9, which
dramatically distorted 9:16 camera views. Playback didn't, so anamorphic
videos looked correct on Chrome but slightly stretched on Firefox. Now
both live streams and playback are fully correct on all browsers.
2021-08-12 13:33:19 -07:00
Scott Lamb 1df55efc43 upgrade some server deps
I avoided rtcp 0.2.2->0.2.3 because of an accidental semver break.
2021-07-09 15:01:15 -07:00
Scott Lamb 75e3b85850 upgrade to retina v0.0.5
While I'm here, return a clean error if a non-initial video frame
includes a parameter change, rather than doing something crazy (#42).
It's still broken under ffmpeg, it's untested, and it's not as clean
as seamlessly starting a new recording with the new parameters, but
it's better than nothing.
2021-07-08 16:06:30 -07:00
Scott Lamb f078328935 prepare v0.6.4 2021-06-28 20:32:33 -07:00
Scott Lamb a0ed74e8e0 use retina 0.0.4
retina 0.0.3 had a fatal bug: it broke after keepalive responses.
2021-06-28 15:41:50 -07:00
Scott Lamb 4c95df5ba7 upgrade to retina 0.0.3
The new version is more efficient.
2021-06-28 14:25:35 -07:00
Scott Lamb 9cb19d5c82 tweak deps, eliminating strsim 0.8 dependency
I also enabled the colored help option for clap, since we're paying for
the color dep anyway.
2021-06-15 00:45:11 -07:00
Scott Lamb 92a365eb73 use released versions of a few deps 2021-06-09 14:36:14 -07:00
Scott Lamb 032bd76577 support --rtsp-library=retina (#37)
This isn't well-tested and doesn't yet support an initial connection
timeout. But in a quick test, it successfully returns video!

I'd like to do some more aggressive code restructuring for zero-copy
and to have only one writer thread per sample file directory (rather
than the syncer thread + one writer thread per RTSP stream). But I'll
likely wait until I drop support for ffmpeg entirely.
2021-06-07 14:40:26 -07:00
Scott Lamb 7699696bd9 remove half-baked analytics module
This is (slightly) complicating the switch from ffmpeg to retina
as the RTSP client. And it's not really that close to what I want
to end up with for analytics:

*   I'd prefer the analytics happen in a separate process for
    several reasons
*   Feeding the entire frame to the object detector doesn't produce
    good results.
*   It doesn't do anything with the results yet anyway.
2021-06-06 21:14:42 -07:00
Scott Lamb 9cc63faf29 logging improvements
*   allow debug/trace logging on release builds again
*   enable log messages from hyper. I didn't notice they went
    away with 0.14.0, although there's a breaking change in the log:
    https://github.com/hyperium/hyper/blob/master/CHANGELOG.md#v0140-2020-12-23
*   downgrade some particularly spammy messages
2021-06-04 23:33:51 -07:00
Scott Lamb 23d77693de read sample files from dedicated threads
Reading from the mmap()ed region in the tokio threads could cause
them to stall:

*   That could affect UI serving when there were concurrent
    UI requests (i.e., not just requests that needed the reads in
    question anyway).
*   If there's a faulty disk, it could cause the UI to totally hang.
    Better to not mix disks between threads.
*   Soon, I want to handle RTSP from the tokio threads (#37). Similarly,
    we don't want RTSP streaming to block on operations from unrelated
    disks.

I went with just one thread per disk which I think is sufficient.
But it'd be possible to do a fixed-size pool instead which might improve
latency when some pages are already cached.

I also dropped the memmap dependency. I had to compute the page
alignment anyway to get mremap to work, and Moonfire NVR already is
Unix-specific, so there wasn't much value from the memmap or memmap2
crates.

Fixes #88
2021-06-04 19:50:13 -07:00
Scott Lamb 0068a9ae70 more anamorphic streams
* my dad's GW4089IP cameras use 720x480
* some Reolink cameras use 640x352
* I'm playing with rotated cameras (16x9 -> 9x16)

I'd prefer to calculate pasp from a configured camera aspect ratio
than to hardcode the assumption these are 16x9, but that requires
a schema change. This is an improvement for now.
2021-05-22 20:45:07 -07:00
Scott Lamb 603f02b686 stop using old tempdir crate 2021-05-17 13:08:18 -07:00
Scott Lamb 13b497e243 update libpasta deps 2021-05-17 13:02:26 -07:00
Scott Lamb 8b37c77558 de-dupe prettydiff deps via a fork 2021-05-17 12:17:18 -07:00
Scott Lamb ef0bc8acf9 update various other deps 2021-05-17 11:05:54 -07:00
Scott Lamb f922afaa26 update rusqlite
The big difference here is query_named and execute_named have gone
away. Fair number of lines changes but straightforward.
2021-05-17 10:50:48 -07:00
Scott Lamb dc1c9afa73 cargo update
The immediate motivation is to address these CI failures with nightly:
https://github.com/scottlamb/moonfire-nvr/runs/2593322801?check_suite_focus=true
```
   Compiling lock_api v0.4.2
error[E0557]: feature has been removed
  --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/lock_api-0.4.2/src/lib.rs:91:42
   |
91 | #![cfg_attr(feature = "nightly", feature(const_fn))]
   |                                          ^^^^^^^^ feature has been removed
   |
   = note: split into finer-grained feature gates
```

Strangely, they don't occur locally with "rustc 1.54.0-nightly
(fe72845f7 2021-05-16)" but do on CI with the exact same version?!?
I don't get it, but lock-api 0.4.4 is advertised as being updated for
latest nightly, so I expect this will address the problem anyway.
2021-05-17 10:31:06 -07:00
Scott Lamb a1e78ea48b better debugging when unable to insert VSE
I saw this error once:

Apr 27 21:01:33 nuc moonfire-nvr[188570]: s-reolink-sub
moonfire_nvr::streamer] reolink-sub: sleeping for Duration { secs: 1,
nanos: 0 } after error: CHECK constraint failed: video_sample_entry

and would like to understand it better.
2021-04-27 22:52:47 -07:00
Scott Lamb 1e314e09d0 refine timestamps in json signals api
*   API change: in update signals, allow setting a start time relative
    to now. This is an accuracy improvement in the case where the client
    has been retrying an initial request for a while. Kind of an obscure
    corner case but easy enough to address. And use a more convenient
    enum representation.

*   in update signals, choose `now` before acquiring the database lock.
    If lock acquisition takes a long time, this more accurately reflects
    the time the caller intended.

*   in general, make Time and Duration (de)serializable and use them
    in json types. This makes the types more self-describing, with
    better debug printing on both the server side and on the client
    library (in moonfire-playground). To make this work, base has to
    import serde which initially seemed like poor layering to me, but
    serde seems to be imported in some pretty foundational Rust crates
    for this reason. I'll go with it.
2021-04-21 21:06:15 -07:00
Scott Lamb 8465b49cfa Prepare v0.6.3 release
...including changelog and new screenshots in the README.
2021-03-31 15:21:09 -07:00
Scott Lamb 2f3e8a8f57 update lexical-core 0.7.4->0.7.5
I hope this will fix the failures on CI:
https://github.com/scottlamb/moonfire-nvr/runs/2199560446?check_suite_focus=true

Looks like this version was made to do so:
https://github.com/rust-lang/rust/issues/81654

The confusing part is that lexical-core 0.7.4 seems to compile fine
on my workstation with nightly-2021-03-25-x86_64-unknown-linux-gnu,
but not on CI with the same version?!? still, this will probably fix it.
2021-03-26 19:07:30 -07:00