Commit Graph

56 Commits

Author SHA1 Message Date
Scott Lamb
b1e1fa9031 codec::Parameters -> codec::ParametersRef
This reduces copying. Part of #47.
2022-05-11 11:37:09 -07:00
Scott Lamb
eecea0b474 update changelog for new msrv 2022-05-10 16:53:19 -07:00
Scott Lamb
6bc3b004a4 Merge branch 'main' into next 2022-05-10 16:52:58 -07:00
Scott Lamb
27c5ed5f04 expose RTCP compound packets
...and rename `PacketItem` variants to `Rtp` and `Rtcp` for brevity.

Fixes #59
2022-05-10 15:58:54 -07:00
Scott Lamb
2530014cce ignore unparseable rtptime values
https://github.com/scottlamb/moonfire-nvr/issues/224
2022-05-09 12:57:20 -07:00
Scott Lamb
3b9c6b8719 bump minimum Rust version to 1.56
The last commit needs at least 1.53 for its use of array's IntoIterator
impl. We might as well bump up to 1.56 and take advantage of the 2021
edition.
2022-04-28 22:19:20 -07:00
Scott Lamb
2e34bf927e revamp Packet type
As described in #47 and #58: revamp this type to keep the full raw
packet, and provide accessors rather than raw fields. It's also
smaller now, which is nice.
2022-04-28 16:13:05 -07:00
Scott Lamb
7ea09dde3c make item enums non_exhaustive 2022-04-28 16:13:05 -07:00
Scott Lamb
1646142322 take transport options at setup time 2022-04-28 16:13:05 -07:00
Scott Lamb
8744bf52d3 split PacketContext and StreamContext
As listed in #47.

This improves throughput in the client/h264 benchmark by about 20%,
I think because we copy fewer bytes around. CodecItem went from 256
bytes to 176.
2022-04-28 16:12:54 -07:00
Scott Lamb
1bbaf29dc9 setup should take a SetupOptions 2022-04-28 15:16:39 -07:00
Scott Lamb
7879414ff8 decruft interface 2022-04-28 15:16:39 -07:00
Scott Lamb
f335e6cbd4 remove deprecated methods 2022-04-28 15:16:39 -07:00
Scott Lamb
decab965a3 prepare v0.3.9 2022-04-12 14:19:24 -07:00
Scott Lamb
70294f4641 improve debug logging on wrong ssrc
As described here:
https://github.com/scottlamb/moonfire-nvr/issues/209#issuecomment-1083307174
2022-04-12 14:14:58 -07:00
Scott Lamb
3153355807 clarify tokio runtime expectations 2022-04-12 13:22:44 -07:00
Scott Lamb
7cbe39213d support ignoring msgs on unassigned RTSP channels
https://github.com/scottlamb/moonfire-nvr/issues/213#issuecomment-1089411093
2022-04-08 15:37:37 -07:00
Scott Lamb
9b4f50231c prepare v0.3.8 2022-03-08 10:37:49 -08:00
Scott Lamb
aff87d1919 fix possible panic reading data from server
Found by inspection. It'd be nice to fuzz the tokio module to more
reliably find problems like this, but it looks like I'd have to make
a bunch more stuff public for that. Maybe later...
2022-03-08 10:34:11 -08:00
Scott Lamb
5b1bb7c7e4 fix #52 with upgrade to sdp-types 0.1.4 2022-03-08 10:05:41 -08:00
Scott Lamb
b26d8a93a7 test+fix AAC depacketization happy path
Formerly interior fragments wouldn't get appended to the buffer, so
depacketization would inevitably fail.

This is progress toward #48.
2022-01-31 11:59:41 -08:00
Scott Lamb
e4be827a63 prep v0.3.7 2022-01-28 09:17:22 -08:00
Scott Lamb
663ff74104 changelog: fix link formatting 2022-01-26 01:13:52 -08:00
Scott Lamb
e551337c91 prep v0.3.6 2021-12-29 22:06:21 -08:00
Scott Lamb
cf08d1faa6 expire live555 stale file descriptor sessions 2021-12-29 21:58:29 -08:00
Scott Lamb
9c85a2dd80 prepare v0.3.5 2021-11-30 12:38:34 -08:00
Scott Lamb
4b9a726a84 documentation improvements 2021-11-30 11:35:53 -08:00
Scott Lamb
01c8780a4d H.264: don't require valid out-of-band params
It's allowed for a server to send only in-band parameters, although I
haven't encountered this yet. The VStarcam cameras sometimes send
invalid out-of-band parameters; treat that as if it sent nothing.

Fixes #42
2021-11-30 09:39:32 -08:00
Scott Lamb
35575b7551 prep v0.3.4 2021-10-26 21:32:54 -07:00
Scott Lamb
969afbf96c v0.3.3, fix #25: better HTTP auth support 2021-10-20 14:43:36 -07:00
Scott Lamb
3a3f01118e prepare v0.3.2 2021-09-29 05:48:36 -07:00
Scott Lamb
82169bcef9 mention TEARDOWN improvements in changelog
Fixes #34
2021-09-29 05:30:58 -07:00
Scott Lamb
379bf840c1 prepare v0.3.1 2021-09-09 22:01:58 -07:00
Scott Lamb
62f6949873 new more reliable TEARDOWN mechanism 2021-09-09 17:34:49 -07:00
Scott Lamb
abf10eac16 use sdp-types 0.1.3 with more permissive parsing
Fixes #26
Fixes #33
2021-09-09 06:58:15 -07:00
Scott Lamb
1056dfbfef UDP fixes (#30)
*   out-of-order packets should be ignored (except for logging).

*   after ignored RTP or RTCP packet, don't incorrectly return Pending
    without both underlying sockets actually returning Pending. This
    could lead to not rechecking the sockets until prompted for another
    reason, like an RTSP keepalive.
2021-09-07 18:28:19 -07:00
Scott Lamb
799584c8e3 skip Geovision's strange pt=50 packets
Once #33 is fixed, this should allow Geovision cameras to more or
less work.
2021-09-07 15:37:09 -07:00
Scott Lamb
ffaa831c54 warn about #30 2021-08-31 13:27:13 -07:00
Scott Lamb
2407fddf86 version 0.3.0 2021-08-31 06:59:47 -07:00
Scott Lamb
60a253073c get rid of ignore_spurious_data
This was an attempt at #17 that didn't work out. Besides additionally
hitting the framing error, my Reolink test camera never timed out
the old session while the new one was in progress. This behavior is
different than the vanilla 2013.04.06 live555 server, so apparently
Reolink sprinkled in their own brokenness on top. In any case,
the other solutions described in that bug are more likely to work.

There's one narrow case I want to keep working: ignoring RTCP messages
immediately prior to the PLAY response. More recent Reolink cameras
do this. I just have this behavior on all the time now.
2021-08-31 06:48:23 -07:00
Scott Lamb
9e9366f115 experimental UDP support (fixes #30)
* support setting transport to UDP
* breaking change: use new PacketContext rather than RtspMessageContext
  in places where an RTP/RTCP packet is expected, as it can now be over
  UDP instead of via RTSP interleaved data
* send teardown, which is important with UDP sessions. (It also will
  help somewhat with Reolink TCP.) Along the way, make Session Unpin
  so that teardown can consume it without tripping over tokio::pin!().
* refactor to shrink the amount of data used by Session and how much
  gets memmoved around on the stack, instead of further growing it.

Because of missing RTCP RR and reorder buffer support, this is only
appropriate for using on a LAN. That's enough for me right now.
2021-08-30 21:40:51 -07:00
Scott Lamb
2911edec70 fix missing 44.1 kHz (#22) 2021-08-23 10:18:27 -07:00
Scott Lamb
59e513c9be v0.2.0 2021-08-20 16:48:22 -07:00
Scott Lamb
7e5ebf1400 join control URLs with base in the "live555 way"
This isn't RFC-compliant, but it seems to be quite common, and it
works with some cameras where the RFC-compliant way does not.
Fixes #9

Based on lucaszanella's PR #12, including his vstarcam test.
2021-08-20 16:42:57 -07:00
Scott Lamb
d8aa4c6565 workaround for Reolink spurious data
Fixes #17

I'm accumulating unit testing debt, but I think I'd rather get this
quickly out in the field to test against scenarios I haven't anticipated
than get my unit tests in order for scenarios I have anticiapted.
2021-08-19 13:00:06 -07:00
Scott Lamb
41765007a6 remove rtcp dependency, prep v0.1.0
rtcp recently had an accidental semver break, so this fixes #8.
I also don't like that newer versions depend on several unnecessary
crates including tokio. retina also depends on tokio, but in the future
I want it to be IO library-agnostic.

I'm moving to v0.1.0 so I *can* release versions that claim semver
compatibility. There are still plenty of API changes to make but also
likely upcoming camera compatibility changes that won't break anything.
2021-08-13 11:37:53 -07:00
Scott Lamb
b1db9a9e8b use SET_PARAMETERS for keepalive
This is the method recommended by the ONVIF Streaming Specification
version 21.06 section 5.2.2.2.

I was using GET_PARAMETERS. This matched ffmpeg's behavior if the
OPTIONS shows that GET_PARAMETERS is supported, although I wasn't doing
the initial OPTIONS request.

Apparently the GW Security GW4089IP will simply ignore GET_PARAMETERS,
not even sending a 405 Method Not Allowed response. It supports and
responds to SET_PARAMETERS.
2021-07-11 20:01:59 -07:00
Scott Lamb
00359bf540 prepare v0.0.5 2021-07-08 15:20:55 -07:00
Scott Lamb
df47b6fa35 mp4 example: handle initial video param change
I've noticed some (buggy) cameras' out-of-band parameters don't quite
match the initial in-band parameters. Out-of-band parameters aren't
required anyway, and this is progress toward handling in-band only.
2021-07-08 15:19:38 -07:00
Scott Lamb
de6658961b shrink several large datastructures
*   Box the remaining Depacketizer variants. I already boxed the largest
    ones, which are also the most common. Might as well box the others
    and not have so much dead space in the common case...
*   Don't keep around a full codec::Parameters on all codecs. This
    shrinks several depacketizers. I also avoid some awkward
    destructuring.
*   Box VideoFrame::new_parameters, which is populated rarely.

```
sizes changes on 64-bit platforms:
type                               before  after
client::Stream                        512    312
codec::Depacketizer                   224     16
codec::aac::Depacketizer              232    208
codec::g723::Depacketizer             200    104
codec::h264::Depacketizer             560    552
codec::onvif::Depacketizer            216    128
codec::simple_audio::Depacketizer     208    112
codec::CodecItem                      240    160
codec::VideoFrame                     232    152
codec::AudioFrame                     104    104
codec::MessageFrame                   104    104
client::rtp::SenderReport              72     72
```
2021-07-08 14:54:42 -07:00