Commit Graph

35 Commits

Author SHA1 Message Date
Scott Lamb
892427592e tweak config format (#133)
* switch from json to toml.
  I think this will be more user-friendly. It allows comments and has
  less punctuation. Fewer surprises than yaml (which has e.g. the
  "Norway problem"). I might have stayed with JSON if I could see a
  good serde json library that allows comments, but hson is unmaintained
  and serde-json strictly follows the spec.

* switch from camelCase to snake_case. Seems more idiomatic for TOML
  and matches the Rust source.

* forbid unknown keys. Better to spot errors sooner.

* rename "trust_forward_hdrs" to "trust_forward_headers". Nothing else
  is abbreviated.
2022-03-16 12:34:39 -07:00
Scott Lamb
ceaef46ea9 introduce /etc/moonfire-nvr.json (#133) 2022-03-09 13:18:33 -08:00
Scott Lamb
9d70d68710 fix #187 via a dependency upgrade
I did a full `cargo upgrade` and fixed what it broke:

*   a couple things for the latest protobuf 3.0 alphas
    (note alphas don't promise API stability)
*   new minimum supported Rust version

This should have some other nice effects: parking_lot now uses inline
assembler, tokio has gotten faster, etc.
2022-03-08 11:24:44 -08:00
Scott Lamb
0406e09ca4 reduce debug output in release/bench builds
This reduces the binary size from 154 MiB to 70 MiB (#70 progress).
Tools like `cargo flamegraph` still work fine.

As suggested by "EarthFeet" on reddit:
https://www.reddit.com/r/rust/comments/rw0jad/cargos_strip_profile_option_has_been_stabilized/hra193k/
2022-01-05 10:28:32 -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
5c7263b1bd include ext stream in API response; better docs
In particular, the docs now explicitly call out that API changes can
happen at any version, and from 0.7.0 onward they're described in
the changelog.
2021-11-23 13:04:02 -08:00
Scott Lamb
cf492a2ffa fix #182: error on upgrade when onvif_host empty 2021-11-23 10:17:47 -08:00
Scott Lamb
1c9a55653d allow setting rtsp transport per-stream 2021-10-27 14:28:44 -07: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
46ac812d3e v0.7.0 2021-10-27 12:03:11 -07:00
Scott Lamb
ddda01e4fa preparing v0.7.0 2021-10-26 18:54:26 -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
095417bb20 Retina 0.3.2, better TEARDOWNs 2021-09-29 05:56:20 -07:00
Scott Lamb
82102c0d17 trim whitespace from /etc/timezone 2021-09-24 10:49:04 -07:00
Scott Lamb
0c0c0692f3 prepare version 0.6.6 2021-09-23 20:02:31 -07:00
Scott Lamb
19faa0f028 changelog tweak 2021-09-23 18:16:39 -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
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
981a91c425 add changelog entry for #157 2021-08-31 16:44:53 -07:00
Scott Lamb
78bafb01f6 support udp with retina or ffmpeg 2021-08-31 08:11:18 -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
4e77a26410 document and check minimum SQLite version
Fixes #147
2021-08-19 10:08:53 -07:00
Scott Lamb
dd4a901adb bump etag format version when headers change
I forgot to do this in 27395ec resulting in #146. Bump the version now,
and update the digest used in the tests so they will remind me to
bump the version any time the headers change.
2021-08-19 09:51:09 -07:00
Scott Lamb
711071f003 prepare version 0.6.5 2021-08-13 12:08:19 -07:00
Scott Lamb
b8b5038f71 better error msg on live view when misconfigured
Improves (but doesn't fix) #119 and #120.
2021-08-13 12:02:42 -07:00
Scott Lamb
42cf77f0d6 upgrade to retina v0.1.0 2021-08-13 11:48:58 -07:00
Scott Lamb
b388aab250 better error message for live view on iOS (#121) 2021-08-13 08:50:06 -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
f078328935 prepare v0.6.4 2021-06-28 20:32:33 -07:00
Scott Lamb
5be69baaa6 switch default RTSP library to retina 2021-06-28 16:38:21 -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
f9c46dca89 fix incorrect prev_media_duration_90k calculation
I spotted this by inspection: adding a media time and wall time didn't
look right. I also confirmed the brokenness on my primary NVR:

```
sqlite> .mode column
sqlite> select
   ...>   r1.composite_id,
   ...>   r1.prev_media_duration_90k,
   ...>   r1.wall_duration_90k,
   ...>   r1.media_duration_delta_90k,
   ...>   r2.composite_id,
   ...>   r2.prev_media_duration_90k
   ...> from
   ...>   recording r1 join recording r2 on (r1.composite_id = r2.composite_id - 1)
   ...> where
   ...>   r1.prev_media_duration_90k + r1.wall_duration_90k + r1.media_duration_delta_90k !=
   ...>     r2.prev_media_duration_90k
   ...> limit 5;
4296791095    2232623913716            5398956            154                       4296791096    2232629312672
4296791096    2232629312672            5400016            38                        4296791097    2232634712688
4296791097    2232634712688            5400729            105                       4296791098    2232640113417
4296791098    2232640113417            5399024            80                        4296791099    2232645512441
4296791099    2232645512441            5400770            124                       4296791100    2232650913211
```

In the first row, the second recording's prev_media_duration_90k is the
first's prev_media_duration_90k plus its wall time, not its media time.
2021-03-25 22:09:29 -07:00
Scott Lamb
6fd4f8975b build cleanly with nightly Rust 2021-03-14+
The CI nightly builds had been broken with the following error:

```
error: custom inner attributes are unstable
  --> /home/runner/work/moonfire-nvr/moonfire-nvr/server/target/debug/build/moonfire-db-415ce696a754c614/out/schema.rs:10:4
   |
10 | #![rustfmt::skip]
   |    ^^^^^^^^^^^^^
   |
   = note: `#[deny(soft_unstable)]` on by default
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266>
```

I'd thought this was by mistake given that #[rustfmt::skip] is still
advertised on rustfmt's github page, but maybe not. Looks like
rust-protobuf's newest version uses
`#![cfg_attr(rustfmt, rustfmt::skip)]` to avoid this error.

Also fix a warning on nightly about an extraneous semicolon.
2021-03-24 08:10:45 -07:00
Scott Lamb
d5320302a3 prepare version 0.6.2 2021-03-12 12:36:20 -08:00
Scott Lamb
10b2be3d54 changelog, including upcoming 0.6.2 2021-03-10 17:53:29 -08:00