Commit Graph

213 Commits

Author SHA1 Message Date
Scott Lamb
f403aecc50
Merge pull request #75 from scottlamb/release-0.4.4
release 0.4.4
2022-12-26 09:28:46 -05:00
Scott Lamb
6058bd89db
release 0.4.4 2022-12-26 09:21:42 -05:00
Scott Lamb
c27865aedf fix parsing of RTP packets with extensions 2022-12-26 09:19:21 -05:00
Scott Lamb
7472b6300e clippy 2022-12-26 09:19:21 -05:00
Scott Lamb
f69d746a42 Tolerate Ubiquiti's useless a=fmtp:96\r in SDP
See #65
2022-10-20 23:17:26 -07:00
Scott Lamb
021a572145 Address CI failures
I'm not sure what changed. We have a
`Cargo.lock`, and these runs were with identical code:

https://github.com/scottlamb/retina/actions/runs/3148795378 passed
https://github.com/scottlamb/retina/actions/runs/3148801810 failed

Nonetheless, the failures started happening on CI (and not my local
machine). Something changed with respect to the other futures are polled
or something. Not having a keepalive future prevents tokio from
"auto-advancing" the paused time (a misfeature IMHO). There's still
some advance I think from background_teardown's timeout_at, but that's late
enough to not cause the same test failure.

Failure below.

```
---- client::tests::simple stdout ----
thread 'client::tests::simple' panicked at 'assertion failed: `(left == right)`
  left: `Options`,
 right: `Teardown`', src/client/mod.rs:2547:17
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
error: test failed, to rerun pass '-p retina --lib'
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:181:5
   4: retina::client::tests::req_response::{{closure}}
             at ./src/client/mod.rs:2547:17
   5: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
   6: <tokio::future::maybe_done::MaybeDone<Fut> as core::future::future::Future>::poll
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/future/maybe_done.rs:68:48
   7: retina::client::tests::simple::{{closure}}::{{closure}}
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/macros/join.rs:116:24
   8: <tokio::future::poll_fn::PollFn<F> as core::future::future::Future>::poll
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/future/poll_fn.rs:38:9
   9: retina::client::tests::simple::{{closure}}
             at ./src/client/mod.rs:2651:9
  10: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/mod.rs:91:19
  11: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/future/future.rs:124:9
  12: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/runtime/basic_scheduler.rs:508:48
  13: tokio::coop::with_budget::{{closure}}
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/coop.rs:102:9
  14: std:🧵:local::LocalKey<T>::try_with
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/thread/local.rs:445:16
  15: std:🧵:local::LocalKey<T>::with
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/thread/local.rs:421:9
  16: tokio::coop::with_budget
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/coop.rs:95:5
  17: tokio::coop::budget
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/coop.rs:72:5
  18: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}::{{closure}}
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/runtime/basic_scheduler.rs:508:25
  19: tokio::runtime::basic_scheduler::Context::enter
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/runtime/basic_scheduler.rs:362:19
  20: tokio::runtime::basic_scheduler::CoreGuard::block_on::{{closure}}
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/runtime/basic_scheduler.rs:507:36
  21: tokio::runtime::basic_scheduler::CoreGuard::enter::{{closure}}
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/runtime/basic_scheduler.rs:565:57
  22: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/macros/scoped_tls.rs:61:9
  23: tokio::runtime::basic_scheduler::CoreGuard::enter
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/runtime/basic_scheduler.rs:565:27
  24: tokio::runtime::basic_scheduler::CoreGuard::block_on
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/runtime/basic_scheduler.rs:498:9
  25: tokio::runtime::basic_scheduler::BasicScheduler::block_on
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/runtime/basic_scheduler.rs:174:24
  26: tokio::runtime::Runtime::block_on
             at /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.19.2/src/runtime/mod.rs:480:46
  27: retina::client::tests::simple
             at ./src/client/mod.rs:2664:9
  28: retina::client::tests::simple::{{closure}}
             at ./src/client/mod.rs:2561:11
  29: core::ops::function::FnOnce::call_once
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5
  30: core::ops::function::FnOnce::call_once
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
```
2022-10-20 23:09:45 -07:00
Scott Lamb
b54ea3f4fd v0.4.3: upgrade h264-reader crate
* match a couple h264-reader semantic changes. E.g., decode_nal now
  expects the full NALU including header byte.

* adjust test data in depacketize_parameter_change. The SDP parameters
  I used were invalid in a way caught only by the new h264-reader crate.
  That's not the intended scenario, so use different parameters. But
  mention the accidental scenario in CHANGELOG.md.

* initialize logging in h264 tests to ease debugging problems like the
  bullet above.

* in AAC code, match h264-reader's switch from bitreader to
  bitstream-io. This keeps dependencies down, in addition to the reasons
  for h264-reader's switch, described here:
  7a02a3b7bd
2022-09-28 22:12:17 -07:00
Scott Lamb
67a6812379 fix clippy errors
These must have popped up with a new version of Rust since last commits.
2022-09-28 09:12:28 -07:00
Scott Lamb
bc03c61ae3 ignore unparseable SDP media
https://github.com/scottlamb/moonfire-nvr/issues/238
2022-09-28 09:12:28 -07:00
Scott Lamb
d6c0e84db8 prep v0.4.1 2022-08-09 07:40:46 -07:00
Scott Lamb
65c7cf8c5f cargo fmt 2022-08-09 06:37:14 -07:00
Scott Lamb
26a7e86076 add debug logs on conn error/eof
The caller gets this information and may do its own logging with more
context. But...sometimes the caller doesn't, and being able to turn
this on is handy then, so log at low priority. (debug; I considered
trace even.)
2022-08-09 06:31:45 -07:00
Scott Lamb
0d6784485b use keepalive compatible with simple-rtsp-server
https://github.com/scottlamb/moonfire-nvr/issues/234
2022-08-07 22:02:26 -07:00
Scott Lamb
da33dddbd7 compute keepalive interval from session timeout
Alessandro Ros
[asserts](https://github.com/aler9/rtsp-simple-server/issues/1066#issuecomment-1206405770)
that some servers have timeouts shorter than 30 seconds; this should
improve compatibility with them. Also add some debug logging around
keepalives.
2022-08-07 11:01:06 -07:00
Scott Lamb
bb3baf0329 unbreak client example 2022-07-15 16:30:54 -07:00
Scott Lamb
a7942f723f remove local debugging webrtc patches 2022-07-15 16:14:53 -07:00
Scott Lamb
692bfaa04e WebRTC proxy example (#60)
This is a very basic version, as a starting point.
2022-07-15 16:12:26 -07:00
Scott Lamb
fa372865e6 upgrade mylog dep to version without parking_lot 2022-07-13 11:48:30 -07:00
Scott Lamb
3a8f11450f clippy cleanup on client example 2022-07-13 11:44:53 -07:00
Scott Lamb
978d0d7791 fixes for workspace split 2022-07-13 11:17:28 -07:00
Scott Lamb
d75d5585f5 move the client example to its own crate
We're likely to add more examples with more dependencies (e.g. ffmpeg,
gstreamer, webrtc). Nice to not have their deps in the main crate's
dev-dependencies, and likewise to have each example show its true
dependencies.

As mentioned here:
https://github.com/scottlamb/retina/issues/19#issuecomment-902302720
2022-07-13 10:51:03 -07:00
Scott Lamb
33bd057ade update some deps 2022-07-11 11:59:40 -07:00
Scott Lamb
2b700fd32b prepare v0.4.0 2022-05-17 16:48:34 -07:00
Scott Lamb
444afdd35d fix clippy error 2022-05-11 13:22:45 -07:00
Scott Lamb
88eaab7fb8 flesh out rtcp module a bit more 2022-05-11 13:09:11 -07:00
Scott Lamb
fff3acc3c9 remove dead retina::client::rtp::SenderReport 2022-05-11 12:49:01 -07:00
Scott Lamb
200a93e905 fix redundancy in Timestamp docs 2022-05-11 12:36:28 -07:00
Scott Lamb
a33ba9b8af no Bytes in AudioParameters interface either
For #47.

Along the way, I simplified `aac::Depacketizer` impl a bit, eliminating
a clone and some redundancy.
2022-05-11 11:56:42 -07:00
Scott Lamb
b1e1fa9031 codec::Parameters -> codec::ParametersRef
This reduces copying. Part of #47.
2022-05-11 11:37:09 -07:00
Scott Lamb
a36b01b715 fix clippy error 2022-05-11 11:37:09 -07:00
Scott Lamb
56fde0d71b remove Bytes from public codec API
Part of #47

The main benefit is that `VideoFrame::into_data` can cheaply return a
`Vec<u8>` that the caller can mutate. In particular, they could convert
H.264 data from Annex B to AVC form or skip non-VCL NALs. Neither of
these transformations add bytes so they're both possible without
allocation.

Audio and message frames still use `Bytes` internally, as that allows
them to avoid copying when the frame is wholly contained in a packet.
I think this is much more common than for video. I didn't add an
`AudioFrame::into_data` or `VideoFrame::into_data`.
2022-05-11 10:43:58 -07:00
Scott Lamb
1b6491370f remove StreamContextRef type
Turns out it's not a problem to keep around a StreamContext, so let's
avoid the complexity of another public type (and another internal type).
2022-05-11 09:27:40 -07:00
Scott Lamb
8caa1d9ae3 rename ReceivedCompoundPacket::context -> ctx
The latter matches other types within Retina.
2022-05-11 08:29:23 -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
511e968733 bump minimum Rust to 1.59
27c5ed5 uses destructuring assignments, introduced in this version.
Should address this CI failure:
https://github.com/scottlamb/retina/actions/runs/2303800235
2022-05-10 16:03:33 -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
06d7150989 fix inverted condition in mp4 bug
This caused it to say every video frame had new parameters.
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
2cc35d1733 shrink Presentation by a word 2022-04-30 16:16:08 -07:00
Scott Lamb
a5e198b0cf use accessors for fields in Stream
* and take advantage of it to use `Box<str>` rather than `String`
  in a couple places (saving a couple words)
* also rename clock_rate to clock_rate_hz for clarity
2022-04-30 12:26:27 -07:00
Scott Lamb
2bbc847754 replace new_parameters with has_new_parameters
As described in #47
2022-04-30 12:08:01 -07:00
Scott Lamb
efc02236d5 use accessors for most codec fields for #47
I left alone `VideoFrame::new_parameters`, as I'll likely eliminate it
as described in #47.
2022-04-30 11:40:28 -07:00
Scott Lamb
f94e2f78d3 fix typo in comment 2022-04-29 12:52:04 -07:00
Scott Lamb
2c8832d02b clippy 2022-04-28 22:31:31 -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
d664f6b1af bump version 2022-04-28 16:14:09 -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