Commit Graph

835 Commits

Author SHA1 Message Date
Scott Lamb
92a365eb73 use released versions of a few deps 2021-06-09 14:36:14 -07:00
Scott Lamb
3a6918f3df raise minimum Rust version to 1.52
as required by Retina
2021-06-07 14:43:26 -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
dependabot[bot]
cf57073d6e Bump ws from 6.2.1 to 6.2.2 in /ui
Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-06 09:56:16 -07:00
dependabot[bot]
568e47b843 Bump dns-packet from 1.3.1 to 1.3.4 in /ui
Bumps [dns-packet](https://github.com/mafintosh/dns-packet) from 1.3.1 to 1.3.4.
- [Release notes](https://github.com/mafintosh/dns-packet/releases)
- [Changelog](https://github.com/mafintosh/dns-packet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mafintosh/dns-packet/compare/v1.3.1...v1.3.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-05 20:02:29 -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
7591146928 fix thinko in video sample chunk code
This caused served chunks to be truncated. On seek, nginx sometimes
served 502 errors, chrome sometimes returned
ERR_CONTENT_LENGTH_MISMATCH, and videos weren't playing properly.
2021-06-04 23:10:13 -07:00
Scott Lamb
bb69d1488e cargo fmt 2021-06-04 20:25:19 -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
90dd68ee7c update nginx tutorial link 2021-06-04 09:00:24 -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
54bd068706 address some no-op clippy warnings 2021-05-17 15:00:51 -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
80ec7ab1d0 cleanup some awkward Option call chains 2021-05-17 09:34:10 -07:00
Scott Lamb
33e8359b01 fix broken toc link 2021-05-15 21:54:53 -07:00
Scott Lamb
d0c7bb0b9c fix broken link to on-demand section 2021-05-15 21:53:36 -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
d99e18d17e adjust support instructions
*   send folks to the issue tracker with the same template as bug
    reports. Gathering this extra info up front should help things
    move more quickly.
*   in the template, ask for camera info.
2021-04-27 11:08:54 -07:00
Scott Lamb
ede1ce3192 mention tools for autodetecting RTSP URLs 2021-04-27 10:59:55 -07:00
Scott Lamb
fcc49a7a11 really fix backward link in README 2021-04-26 22:21:39 -07:00
Scott Lamb
67cd886555 fix backward link in README 2021-04-26 22:21:08 -07:00
Scott Lamb
c53250c0c5 support negating Durations 2021-04-22 10:04:22 -07:00
Scott Lamb
d99cab5f27 std::time::Duration -> base::Duration conversion 2021-04-22 09:56:01 -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
dependabot[bot]
5da5494dfb Bump ssri from 6.0.1 to 6.0.2 in /ui
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-19 20:52:59 -07:00
Scott Lamb
4ffb922805 fix request of death in /api/signals 2021-04-12 21:57:16 -07:00
Iron Oxidizer
146a27aac7
improved hard drive setup docs (#122)
* Use the standard UUID syntax for /etc/fstab

* Added instruction to create sample directory

* Update install.md

* Change sample ownership instead of perms
2021-04-11 21:15:45 -07:00
Scott Lamb
2936c138c5 various doc improvements
I bumped the minimum Rust version because I'm taking advantage of
the rustdoc linking added in Rust 1.48:
https://blog.rust-lang.org/2020/11/19/Rust-1.48.html#easier-linking-in-rustdoc
2021-04-10 17:34:52 -07:00
Scott Lamb
98d106553a add a quick troubleshooting note about #119 2021-04-09 14:28:20 -07:00
Scott Lamb
7c0a634bed avoid clock problems on some Docker setups
In particular, this was happening out of the box on Raspberry Pi OS Lite
20210304, as reported by ironoxidizer@gmail.com here:
https://groups.google.com/g/moonfire-nvr-users/c/2j9LvfFl2u8/m/tJcNS2WfCQAJ

*   adjust main.rs to make the problem more obvious
*   mention it in the troubleshooting guide
*   sidestep it in the nvr docker wrapper script

also just use --networking=host rather than --publish (avoiding a proxy
process). I'm using Docker to simplify the build and deployment process,
not as a security boundary, so just do the simpler thing.
2021-04-08 22:21:03 -07:00
Scott Lamb
0c34ea8314 optionally skip installing panic hook
For debugging this failure:
https://groups.google.com/g/moonfire-nvr-users/c/2j9LvfFl2u8/m/bWpwFilTCQAJ
2021-04-07 22:54:02 -07:00
Scott Lamb
f8d5610e3e add links directly from code to standards page 2021-04-01 16:11:33 -07:00
Scott Lamb
9d6a3f815c add some more doc links 2021-04-01 15:42:48 -07:00
Scott Lamb
31ce270007 mention YouTube tour (#82) in contributing guide 2021-04-01 15:39:24 -07:00
Scott Lamb
770e76d342 add a contributing guide
Questions about how to contribute come up from time to time, eg:
https://github.com/scottlamb/moonfire-nvr/issues/84#issuecomment-656065208
https://github.com/scottlamb/moonfire-nvr/issues/68#issuecomment-688938108

I hope this helps answer them. I think github adds a couple links to
a file called CONTRIBUTING or CONTRIBUTING.md so this filename gives it
some extra visibility.
2021-04-01 15:28:46 -07:00
Scott Lamb
4d4d78ba64 mass markdown reformatting
Add tables of contents (using the VS Code Markdown All-In-One extension)
and reformat lists to consistently use 4-space indents. No content
changes.
2021-04-01 12:32:31 -07:00
Scott Lamb
74b13a0fbf add troubleshooting info about out of disk space
As discussed in #84. Also reorganize the troubleshooting guide a bit so
it will be easier to navigate as it grows.
2021-04-01 11:43:21 -07:00
Scott Lamb
96255efd3e increase disk space slack recommendation
As discussed in #84 and #116.
2021-04-01 10:01:46 -07:00
Scott Lamb
a434b42672 live stream troubleshooting info 2021-03-31 16:36: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
560fe804d6 use SameSite=Lax instead of SameSite=Strict
To improve reliability of live streams (#59) on Safari.

Safari was dropping the cookie from websocket update requests.
(But it worked sometimes. I don't get why.) I saw folks on the Internet
thinking this related to HttpOnly:

*   https://developer.apple.com/forums/thread/104488
*   https://stackoverflow.com/q/47742807/23584

but I still see this behavior without HttpOnly. SameSite=Strict vs
SameSite=Lax appears to make a difference. Try that instead.
SameSite=Strict is pointless for us anyway as noted in a new comment.
Turning off HttpOnly would be more unfortunate security-wise.
2021-03-31 13:08:03 -07:00
Scott Lamb
2fe961f382 improve live camera error handling
*   don't error out on websocket error message. The close message has
    more useful info. (Unfortunately though, for security reasons it
    doesn't give too much to the script on initial connection failure.)
*   restore normal (non-error/waiting) state when switching cameras.
*   prefix all log messages with the camera name
2021-03-31 09:08:34 -07:00
Scott Lamb
f34937220d minor error handling improvements
*   When the MediaSource is in error state (or busy, I think),
    endOfStream throws an exception. This prevented the error from being
    properly displayed in the UI. We don't really need to call
    endOfStream, I guess.
*   including an Event in a format string just said [Object object],
    at least on Safari. Use the type instead, which I think is the
    only useful info in the event anyway.
2021-03-30 16:31:13 -07:00
Scott Lamb
d7f4b255bf when developing on Safari, strip HttpOnly
This might be necessary in the production/https case too. But try this
first.
2021-03-30 16:25:20 -07:00