Commit Graph

62 Commits

Author SHA1 Message Date
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
Scott Lamb
e9a5e4e34a overhaul error type
*   stop using deprecated failure crate and its deps

*   more uniformly detailed error messages

*   an enum of the type of error, currently internal-only. I'm not
    confident enough I understand what cases a caller might want to
    distinguish, so I added a comment inviting input instead of
    exposing it now.

*   while I'm at it, separate connection context and message contexts.
    This shrinks some of the data memmoved around in PacketItem and
    CodecItem.
2021-07-08 11:28:07 -07:00
Scott Lamb
7f32639608 don't break after keepalive response!
prepare v0.0.4 immediately; v0.0.3 is effectively unusable.

I want to test this properly, but I haven't yet figured out how to set
up good mocks of tokio::Sleep and such. For now just fix the bug.
2021-06-28 15:30:28 -07:00
Scott Lamb
037c501dfb prepare v0.0.3 release 2021-06-28 14:16:13 -07:00
Scott Lamb
48f2c2eb15 directly implement Stream on Session<Playing>
The new implementation has several benefits:

*   it's more correct, in a way that probably doesn't matter now but
    will if we ever send ONVIF backchannel audio. See the removed
    comment about deadlock possibility. Similarly, I realized that if
    packets became readable halfway through flushing a keepalive, the
    keepalive future would be improperly dropped as described at
    the beginning of this blog post:
    https://carllerche.com/2021/06/17/six-ways-to-make-async-rust-easier/

*   we'll be able to make other method calls on the Session while using
    the stream, eg sending audio with ONVIF backchannel

*   it's 8% faster according to the client benchmark.

*   it doesn't pull in the async-stream dependency anymore.

*   we can name the type of the stream, avoiding a Box in some cases.
2021-06-28 13:51:19 -07:00
Scott Lamb
dacbca8c28 speed up interleaved data parsing
This is a 20% improvement on the freshly-added benchmark.
2021-06-28 10:29:27 -07:00
Scott Lamb
6503398d3f prepare v0.0.2 2021-06-25 16:48:41 -07:00