ka9q-python 3.26.2__tar.gz → 3.29.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/CHANGELOG.md +122 -0
- {ka9q_python-3.26.2/ka9q_python.egg-info → ka9q_python-3.29.0}/PKG-INFO +6 -1
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/README.md +5 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/API_REFERENCE.md +5 -3
- ka9q_python-3.29.0/docs/INDEX.md +28 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/advanced_features_demo.py +4 -4
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/cli.py +0 -2
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/compat.py +1 -1
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/control.py +65 -17
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/multi_stream.py +60 -22
- ka9q_python-3.29.0/ka9q/resequencer.py +696 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/spectrum_stream.py +35 -3
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/status.py +25 -6
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/stream.py +49 -21
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/stream_quality.py +9 -2
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/tui.py +0 -2
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/types.py +11 -3
- {ka9q_python-3.26.2 → ka9q_python-3.29.0/ka9q_python.egg-info}/PKG-INFO +6 -1
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q_python.egg-info/SOURCES.txt +3 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q_radio_compat +1 -1
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/pyproject.toml +1 -1
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/scripts/sync_types.py +34 -0
- ka9q_python-3.29.0/tests/test_resequencer_accounting.py +944 -0
- ka9q_python-3.29.0/tests/test_set_spectrum.py +223 -0
- ka9q_python-3.29.0/tests/test_sweep.py +152 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_zero_block_detection.py +14 -6
- ka9q_python-3.26.2/ka9q/resequencer.py +0 -452
- ka9q_python-3.26.2/tests/test_set_spectrum.py +0 -128
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/LICENSE +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/MANIFEST.in +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/ARCHITECTURE.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/CLI_GUIDE.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/GETTING_STARTED.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/INSTALLATION.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/MULTI_STREAM.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/POLL-SUPPRESSION-DESIGN.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/RECIPES.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/REQUIREMENTS.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/RTP_TIMING_SUPPORT.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/SECURITY.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/TESTING_GUIDE.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/TUI_GUIDE.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/README.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/clients.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/contract.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/control-surface.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/findings.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/idempotency.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/upstream.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/superpowers/plans/2026-08-12-upstream-alignment-and-client-compat.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/superpowers/plans/2026-08-13-audit-remediation.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/superpowers/plans/2026-08-13-client-side-fixes.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/docs/superpowers/specs/2026-08-12-upstream-alignment-and-client-compat-design.md +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/channel_cleanup_example.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/codar_oceanography.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/diagnostics/diagnose_packets.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/diagnostics/repro_utc_bug.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/discover_example.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/grape_integration_example.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/hf_band_scanner.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/multi_stream_smoke.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/rtp_recorder_example.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/simple_am_radio.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/spectrum_example.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/stream_example.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/superdarn_recorder.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/test_channel_operations.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/test_improvements.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/test_timing_fields.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/tune.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/examples/tune_example.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/__init__.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/_multicast.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/addressing.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/discovery.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/exceptions.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/managed_stream.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/monitor.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/pps_calibrator.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/recovery_ladder.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/rtp_recorder.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/slot_clock.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/status_listener.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q/utils.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q_python.egg-info/dependency_links.txt +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q_python.egg-info/entry_points.txt +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q_python.egg-info/requires.txt +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/ka9q_python.egg-info/top_level.txt +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/scripts/check_upstream_drift.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/scripts/gen_client_manifest.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/setup.cfg +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/__init__.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/conftest.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_addressing.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_channel_verification.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_client_contract.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_client_id_destination.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_compat_pin_reachability.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_create_split_encoding.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_decode_description.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_decode_functions.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_delivered_rtp_start.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_destination_required.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_encode_functions.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_encode_socket.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_ensure_channel_encoding.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_filter_edges.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_gen_client_manifest.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_idempotency_integration.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_integration.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_iq_20khz_f32.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_keepalive_encoding.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_lifetime.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_listen_multicast.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_managed_stream_recovery.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_monitor.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_multicast_helpers.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_multihomed.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_multistream_completeness.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_multistream_gap_storm.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_multistream_prune.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_multistream_restore.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_native_discovery.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_parameter_vector.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_parse_rtp_samples_iq.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_performance_fixes.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_poll_channel_idle.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_protocol_compat.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_recovery_ladder.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_remove_channel.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_rtp_recorder.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_rtp_to_wallclock_deprecated.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_security_features.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_set_demod_type.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_set_lock_warns.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_slot_clock.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_spectrum.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_ssrc_dest_unit.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_ssrc_encoding_unit.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_ssrc_radiod_host_unit.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_status_decoder.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_status_listener.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_status_socket_drain.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_sync_types.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_ttl_warning.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_tune.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_tune_cli.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_tune_debug.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_tune_live.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_tune_method.py +0 -0
- {ka9q_python-3.26.2 → ka9q_python-3.29.0}/tests/test_upstream_drift.py +0 -0
|
@@ -1,5 +1,127 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.29.0 (2026-11-27)
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **`SpectrumStream` no longer leaks its radiod channel when the client dies.**
|
|
8
|
+
radiod never reaps a 0 Hz spectrum channel that carries no lifetime, so a
|
|
9
|
+
client killed before `stop()` left its channel running for good. On SIGMA
|
|
10
|
+
the chirp scout's smoke test (2026-11-19) leaked four. Each poll now
|
|
11
|
+
refreshes a lifetime (`lifetime_frames`, default 1000 frames, about 20 s),
|
|
12
|
+
and `stop()` shortens it to 50 frames before removing the channel
|
|
13
|
+
(radiod creates a channel for a command to an unknown SSRC, so the
|
|
14
|
+
reverse order could start a ghost). A
|
|
15
|
+
lifetime shorter than two poll intervals raises `ValueError`.
|
|
16
|
+
`lifetime_frames=0` keeps the old, infinite lifetime.
|
|
17
|
+
- **`set_spectrum()` takes `lifetime`**, sent as LIFETIME in the same packet,
|
|
18
|
+
so the spectrum channel keeps one write path.
|
|
19
|
+
|
|
20
|
+
## 3.28.0 (2026-11-22)
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- **The resequencer counted each lost-packet recovery twice.** Both
|
|
25
|
+
`_handle_lost_packet` and `_try_output` added the recovery's fill and packet
|
|
26
|
+
to `cumulative_samples` and `stats.samples_output`. Now only `_try_output`
|
|
27
|
+
and `flush` count, once per emitted sample.
|
|
28
|
+
- **`GapEvent.position_samples` now gives the gap's true offset in the emitted
|
|
29
|
+
stream.** It used to carry `cumulative_samples` at detection. That value
|
|
30
|
+
inherited the double count and ignored samples emitted earlier in the same
|
|
31
|
+
call. A radiod zero-block marker now leaves with its zeros, at their offset,
|
|
32
|
+
rather than when the packet arrives.
|
|
33
|
+
- **`flush()` orders packets from `next_expected_seq`, wrap-safe.** Across
|
|
34
|
+
65535 -> 0 it used to emit seq 65535 after 0 and 1. It now counts its fills
|
|
35
|
+
in `samples_filled` and sets `last_chunk_rtp_start`, so the final batch at
|
|
36
|
+
stop carries a `delivered_rtp_start`.
|
|
37
|
+
- **A gap longer than `MAX_GAP_SAMPLES` gets its true length.** The old cap
|
|
38
|
+
truncated the fill, and every client that labels samples as
|
|
39
|
+
`first_rtp_timestamp + count` slipped by the difference. Gaps up to
|
|
40
|
+
`max_fill_seconds` (default 120 s) now fill in full. A longer forward jump
|
|
41
|
+
(a re-based RTP clock, or a very long outage) fills nothing. The resequencer
|
|
42
|
+
then reports a `STREAM_INTERRUPTION` event (duration 0) and starts a fresh
|
|
43
|
+
chunk at the post-gap packet. `RadiodStream` and `MultiStream` deliver the
|
|
44
|
+
samples before the break as their own batch. They then re-base
|
|
45
|
+
`first_rtp_timestamp`, so `first_rtp_timestamp + total_samples_delivered`
|
|
46
|
+
still names the RTP of the next sample.
|
|
47
|
+
- **`RadiodStream` keeps gap events from a call that produced no output**, as
|
|
48
|
+
`MultiStream` already did.
|
|
49
|
+
- **An empty-payload packet no longer counts its span twice.** Its
|
|
50
|
+
`EMPTY_PAYLOAD` event now carries duration 0 and adds nothing to
|
|
51
|
+
`total_gaps_filled`. The resequencer fills the missing span, if any, and
|
|
52
|
+
counts it once.
|
|
53
|
+
- **The zero fill has an absolute ceiling: 64 MiB of the sample dtype**
|
|
54
|
+
(`fill_byte_budget`), as well as `max_fill_seconds`. At 192 kS/s complex64
|
|
55
|
+
that allows about 44 s. A longer jump becomes a `STREAM_INTERRUPTION`.
|
|
56
|
+
- **A backward RTP jump now breaks continuity the same way** as a forward jump
|
|
57
|
+
past the bound. It used to pass silently and leave
|
|
58
|
+
`first_rtp_timestamp + count` wrong for the rest of the stream.
|
|
59
|
+
- **The resequencer drops a packet that arrives behind `next_expected_seq`**:
|
|
60
|
+
a duplicate of a packet already emitted, or one more than `buffer_size/2`
|
|
61
|
+
late. It used to re-emit old samples and then fill zeros for time already
|
|
62
|
+
delivered. `stats.packets_late` counts the drops, and RadiodStream reports
|
|
63
|
+
them as `rtp_packets_late`. `stats.interruptions` counts interruptions.
|
|
64
|
+
- **A restarted RTP sequence re-syncs the stream.** radiod re-creates a
|
|
65
|
+
channel from its template, so after a radiod restart or a re-created channel
|
|
66
|
+
the sequence starts again from the template's value. The resequencer drops
|
|
67
|
+
as late only packets up to `buffer_size` behind `next_expected_seq`. A packet
|
|
68
|
+
further behind becomes a re-sync candidate. After `RESYNC_PACKETS` (4) such
|
|
69
|
+
packets in sequence with each other, the resequencer emits what it still
|
|
70
|
+
holds and restarts at the new run with one `STREAM_INTERRUPTION`, so the
|
|
71
|
+
streams re-base as for a forward jump. A lone stale or forged packet only
|
|
72
|
+
gets dropped. A run whose timestamps sit on the current stream's RTP line
|
|
73
|
+
holds real stragglers more than `buffer_size` late: recovery has already
|
|
74
|
+
filled their span, so they get dropped as late rather than delivered twice.
|
|
75
|
+
A run counts as stragglers only within 4 x `buffer_size` behind, and only if
|
|
76
|
+
recovery zero-filled every one of its sequence numbers since the last break.
|
|
77
|
+
radiod can re-create a channel exactly on its old RTP line; such a restart
|
|
78
|
+
still re-syncs.
|
|
79
|
+
- **Interruption ERRORs are rate-limited** to one per 10 s, with a count of
|
|
80
|
+
the ones suppressed. A small backward step on every packet adds a hint: the
|
|
81
|
+
parsed sample count exceeds the RTP step, so the channel count or encoding
|
|
82
|
+
probably mismatches.
|
|
83
|
+
- **MultiStream's health monitor also watches output.** A slot whose packets
|
|
84
|
+
keep arriving while nothing comes out of its resequencer for
|
|
85
|
+
`drop_timeout_sec` now gets dropped and restored.
|
|
86
|
+
- **`flush()` stops before a `STREAM_INTERRUPTION`** and keeps the post-gap
|
|
87
|
+
packets for the next call (`pending` tells when more remain). `stop()` in
|
|
88
|
+
RadiodStream and MultiStream drains it chunk by chunk, so the post-gap
|
|
89
|
+
samples form their own batch with their own label and a re-based anchor.
|
|
90
|
+
RadiodStream's `stop()` now counts the flushed gaps in its totals.
|
|
91
|
+
- **MultiStream hands its callback a copy of the quality object**, as
|
|
92
|
+
RadiodStream does, so a later re-base cannot change a delivered batch's
|
|
93
|
+
anchor.
|
|
94
|
+
- **`stop()` delivers the last pending batch.** `RadiodStream` and
|
|
95
|
+
`MultiStream` dropped it whenever `flush()` had nothing left to add.
|
|
96
|
+
|
|
97
|
+
## 3.27.0 (2026-11-11)
|
|
98
|
+
|
|
99
|
+
### Changed
|
|
100
|
+
|
|
101
|
+
- **The ka9q-radio pin moves from 401992cd (09-19) to aa52698c (11-02),
|
|
102
|
+
Phil's main.** `sync_types.py --apply` regenerated `types.py`. The 167
|
|
103
|
+
commits between them leave the wire format alone: every existing tag keeps
|
|
104
|
+
its number and its encoded type. Phil changed `encode_float` and
|
|
105
|
+
`decode_float` to take and return `float`, but a float still travels in
|
|
106
|
+
4 bytes and a double in 8.
|
|
107
|
+
- **Phil dropped the doppler tags.** Tags 37 and 38 now read `UNUSED6` and
|
|
108
|
+
`UNUSED7`. `ChannelStatus.doppler` and `doppler_rate` stay, always `None`,
|
|
109
|
+
so code that reads them keeps running. `set_doppler()` raises and points
|
|
110
|
+
to `set_sweep()`. The status decoder no longer names the removed tags; it
|
|
111
|
+
would have raised `AttributeError` on any packet that reached that branch.
|
|
112
|
+
|
|
113
|
+
### Added
|
|
114
|
+
|
|
115
|
+
- **Sweep (dechirp) support.** radiod's `SWEEP_RATE`, `SWEEP_DURATION`,
|
|
116
|
+
`SWEEP_PERIOD` and `SWEEP_START` (118-121) now come from upstream.
|
|
117
|
+
`RadiodControl.set_sweep()` sets them, and `ChannelStatus` reports them.
|
|
118
|
+
The epoch pair, `SWEEP_EPOCH_SAMPLE` and `SWEEP_EPOCH_FRAC` (217, 216),
|
|
119
|
+
stays in `sync_types.py`'s pending-upstream table until Phil takes the
|
|
120
|
+
dechirp PR and assigns final numbers.
|
|
121
|
+
- **`tests/client_usage_manifest.json` covers what the clients call today.**
|
|
122
|
+
hf-timestd, hfdl-recorder, meteor-scatter, phase-engine, psk-recorder and
|
|
123
|
+
wspr-recorder had come to use symbols the contract test never checked.
|
|
124
|
+
|
|
3
125
|
## 3.26.2 (2026-11-01)
|
|
4
126
|
|
|
5
127
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ka9q-python
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.29.0
|
|
4
4
|
Summary: Python interface for ka9q-radio control and monitoring
|
|
5
5
|
Author-email: Michael Hauan AC0G <ac0g@hauan.org>
|
|
6
6
|
License: MIT
|
|
@@ -284,6 +284,11 @@ The `--apply` mode updates three files atomically:
|
|
|
284
284
|
2. `ka9q_radio_compat` — updated with the new commit hash
|
|
285
285
|
3. `ka9q/compat.py` — updated with the new commit hash (importable)
|
|
286
286
|
|
|
287
|
+
Tags HamSCI defines ahead of upstream (the sweep TLVs) live in
|
|
288
|
+
`PENDING_UPSTREAM_STATUS_TABLE` in `scripts/sync_types.py`; `--apply` re-emits
|
|
289
|
+
them into `types.py`, so it stays idempotent. `--check` fails if upstream
|
|
290
|
+
reuses one of their numbers and warns when upstream gains the name.
|
|
291
|
+
|
|
287
292
|
### For Deployment Tooling
|
|
288
293
|
|
|
289
294
|
`ka9q-update` (or any deployment tool) can read the pinned commit to ensure the correct `radiod` version is running:
|
|
@@ -250,6 +250,11 @@ The `--apply` mode updates three files atomically:
|
|
|
250
250
|
2. `ka9q_radio_compat` — updated with the new commit hash
|
|
251
251
|
3. `ka9q/compat.py` — updated with the new commit hash (importable)
|
|
252
252
|
|
|
253
|
+
Tags HamSCI defines ahead of upstream (the sweep TLVs) live in
|
|
254
|
+
`PENDING_UPSTREAM_STATUS_TABLE` in `scripts/sync_types.py`; `--apply` re-emits
|
|
255
|
+
them into `types.py`, so it stays idempotent. `--check` fails if upstream
|
|
256
|
+
reuses one of their numbers and warns when upstream gains the name.
|
|
257
|
+
|
|
253
258
|
### For Deployment Tooling
|
|
254
259
|
|
|
255
260
|
`ka9q-update` (or any deployment tool) can read the pinned commit to ensure the correct `radiod` version is running:
|
|
@@ -143,7 +143,7 @@ Tuning & filter:
|
|
|
143
143
|
- `set_sample_rate(ssrc, sample_rate)`
|
|
144
144
|
- `set_shift_frequency(ssrc, shift_hz)`
|
|
145
145
|
- `set_first_lo(ssrc, frequency_hz)`
|
|
146
|
-
- `
|
|
146
|
+
- `set_sweep(ssrc, rate_hz_per_s, period_s, duration_s=None, start_s=0.0)` (replaces retired `set_doppler`, which now raises)
|
|
147
147
|
- `set_filter(ssrc, low_edge=None, high_edge=None, kaiser_beta=None)`
|
|
148
148
|
- `set_kaiser_beta(ssrc, beta)`
|
|
149
149
|
- `set_filter2(ssrc, blocksize, kaiser_beta=None)`
|
|
@@ -335,8 +335,10 @@ grouped by category:
|
|
|
335
335
|
|
|
336
336
|
- **Identification** — `ssrc`, `description`, `preset`, `demod_type`,
|
|
337
337
|
`rtp_pt`, `command_tag`, `gps_time`, `rtp_timesnap`.
|
|
338
|
-
- **Tuning** — `frequency`, `first_lo`, `second_lo`, `shift
|
|
339
|
-
`doppler
|
|
338
|
+
- **Tuning** — `frequency`, `first_lo`, `second_lo`, `shift`.
|
|
339
|
+
(`doppler` and `doppler_rate` remain but stay None: radiod dropped them.)
|
|
340
|
+
- **Sweep** — `sweep_rate`, `sweep_duration`, `sweep_period`, `sweep_start`,
|
|
341
|
+
`sweep_epoch_sample`, `sweep_epoch_frac`.
|
|
340
342
|
- **Filter** — `low_edge`, `high_edge`, `kaiser_beta`,
|
|
341
343
|
`filter_blocksize`, `filter_fir_length`, `filter_drops`, `noise_bw`.
|
|
342
344
|
- **Squelch / AGC / gain** — `snr_squelch_enable`, `squelch_open`,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# ka9q-python documentation index
|
|
2
|
+
|
|
3
|
+
> **Audience:** all
|
|
4
|
+
> **Status:** current
|
|
5
|
+
> **Verified against:** ka9q-python 95098cf on 2026-11-21 — docs
|
|
6
|
+
> **Canonical for:** the map of this repo's docs
|
|
7
|
+
|
|
8
|
+
ka9q-python is a library (also on PyPI) in the HamSCI sigmond suite. ★ = canonical; when two docs disagree the ★ one wins.
|
|
9
|
+
Suite-wide front door: [HamSCI/sigmond docs](https://github.com/HamSCI/sigmond/blob/main/docs/README.md); every component: [the suite's components](https://github.com/HamSCI/sigmond/blob/main/docs/COMPONENTS.md).
|
|
10
|
+
|
|
11
|
+
| Doc | Audience | What it gives you |
|
|
12
|
+
|-----|----------|-------------------|
|
|
13
|
+
| [../README.md](../README.md) | all | what the library is, quick start |
|
|
14
|
+
| [GETTING_STARTED.md](GETTING_STARTED.md) ★ | all | first steps with the library |
|
|
15
|
+
| [INSTALLATION.md](INSTALLATION.md) ★ | all | ways to install and use the package |
|
|
16
|
+
| [RECIPES.md](RECIPES.md) ★ | contributor | task-oriented cookbook |
|
|
17
|
+
| [API_REFERENCE.md](API_REFERENCE.md) ★ | contributor | every public symbol |
|
|
18
|
+
| [ARCHITECTURE.md](ARCHITECTURE.md) ★ | contributor | module layout and abstraction layers |
|
|
19
|
+
| [CLI_GUIDE.md](CLI_GUIDE.md) ★ | operator/contributor | the `ka9q` command |
|
|
20
|
+
| [TUI_GUIDE.md](TUI_GUIDE.md) ★ | operator/contributor | the terminal UI for a live radiod |
|
|
21
|
+
| [MULTI_STREAM.md](MULTI_STREAM.md) ★ | contributor | MultiStream, the shared-socket receiver |
|
|
22
|
+
| [RTP_TIMING_SUPPORT.md](RTP_TIMING_SUPPORT.md) ★ | contributor | GPS_TIME and RTP_TIMESNAP: RTP timestamps to UTC |
|
|
23
|
+
| [SECURITY.md](SECURITY.md) ★ | all | the security model to assume with radiod's control protocol |
|
|
24
|
+
| [TESTING_GUIDE.md](TESTING_GUIDE.md) ★ | contributor | running the test suite |
|
|
25
|
+
| [REQUIREMENTS.md](REQUIREMENTS.md) ★ | contributor | formal requirements, retroactive baseline v0.1 |
|
|
26
|
+
| [POLL-SUPPRESSION-DESIGN.md](POLL-SUPPRESSION-DESIGN.md) | contributor | design, not built: keeping channels alive on a shared control plane |
|
|
27
|
+
| [superpowers/](superpowers/) | — | design records |
|
|
28
|
+
| [audit/](audit/) | — | audit records (2026-08-12 alignment) |
|
|
@@ -18,10 +18,10 @@ def main():
|
|
|
18
18
|
|
|
19
19
|
print("=== Advanced RadioD Feature Demonstrations ===\n")
|
|
20
20
|
|
|
21
|
-
# 1.
|
|
22
|
-
print("1. Setting
|
|
23
|
-
control.
|
|
24
|
-
print(" ✓
|
|
21
|
+
# 1. Linear sweep (dechirp), replaces the retired Doppler command
|
|
22
|
+
print("1. Setting a linear sweep (dechirp)")
|
|
23
|
+
control.set_sweep(ssrc=ssrc, rate_hz_per_s=-25733.913, period_s=1.0)
|
|
24
|
+
print(" ✓ Sweep: -25733.913 Hz/s, period 1 s\n")
|
|
25
25
|
|
|
26
26
|
# 2. PLL configuration for carrier tracking
|
|
27
27
|
print("2. Configuring PLL for coherent AM detection")
|
|
@@ -54,8 +54,6 @@ def _render_status_text(st: ChannelStatus) -> str:
|
|
|
54
54
|
L.append(f" First LO: {_fmt_hz(st.first_lo)} lock={fe.lock}")
|
|
55
55
|
L.append(f" Second LO: {_fmt_hz(st.second_lo)}")
|
|
56
56
|
L.append(f" Shift: {_fmt_hz(st.shift)}")
|
|
57
|
-
if st.doppler:
|
|
58
|
-
L.append(f" Doppler: {_fmt_hz(st.doppler)} @ {st.doppler_rate} Hz/s")
|
|
59
57
|
L.append(f" Filter: {_fmt_hz(st.low_edge)} .. {_fmt_hz(st.high_edge)} (β={st.kaiser_beta})")
|
|
60
58
|
L.append(f" FE filter: {_fmt_hz(fe.fe_low_edge)} .. {_fmt_hz(fe.fe_high_edge)}")
|
|
61
59
|
L.append("")
|
|
@@ -23,7 +23,9 @@ PARAMETERS:
|
|
|
23
23
|
import socket
|
|
24
24
|
import select
|
|
25
25
|
import struct
|
|
26
|
+
import math
|
|
26
27
|
import secrets
|
|
28
|
+
import warnings
|
|
27
29
|
import logging
|
|
28
30
|
import threading
|
|
29
31
|
import hashlib
|
|
@@ -2624,32 +2626,68 @@ class RadiodControl:
|
|
|
2624
2626
|
logger.info("Metrics reset")
|
|
2625
2627
|
|
|
2626
2628
|
def set_doppler(self, ssrc: int, doppler_hz: float = 0.0, doppler_rate_hz_per_sec: float = 0.0):
|
|
2629
|
+
"""Retired: radiod dropped DOPPLER_FREQUENCY/_RATE in ka9q 64938af7.
|
|
2630
|
+
|
|
2631
|
+
Use :meth:`set_sweep`. Sends nothing.
|
|
2627
2632
|
"""
|
|
2628
|
-
|
|
2629
|
-
|
|
2633
|
+
warnings.warn("set_doppler is retired; radiod dropped DOPPLER (ka9q 64938af7); use set_sweep",
|
|
2634
|
+
DeprecationWarning, stacklevel=2)
|
|
2635
|
+
raise RuntimeError("radiod dropped DOPPLER (ka9q 64938af7); use set_sweep")
|
|
2636
|
+
|
|
2637
|
+
def set_sweep(self, ssrc: int, rate_hz_per_s: float, period_s: float,
|
|
2638
|
+
duration_s: Optional[float] = None, start_s: float = 0.0) -> None:
|
|
2639
|
+
"""
|
|
2640
|
+
Command a linear sweep (dechirp) on a linear-demod channel.
|
|
2641
|
+
|
|
2642
|
+
Sends all four sweep TLVs, zeros explicit, so a command always
|
|
2643
|
+
replaces the whole sweep. radiod checks the merged settings after
|
|
2644
|
+
each command and refuses (logs, leaves the channel unswept) a rate
|
|
2645
|
+
without a period, duration > period, or an NCO-limit violation.
|
|
2646
|
+
|
|
2630
2647
|
Args:
|
|
2631
2648
|
ssrc: SSRC of the channel
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2649
|
+
rate_hz_per_s: sweep rate, Hz/s, signed (positive = up); 0 = no sweep
|
|
2650
|
+
period_s: sweep period in seconds (required for a nonzero rate)
|
|
2651
|
+
duration_s: seconds of each period that sweep (default: whole period)
|
|
2652
|
+
start_s: offset added to the sweep time base, seconds (default 0)
|
|
2653
|
+
|
|
2654
|
+
Raises:
|
|
2655
|
+
ValidationError: non-finite value; rate != 0 without
|
|
2656
|
+
0 < period <= 1e6 s; duration outside [0, period]
|
|
2657
|
+
|
|
2658
|
+
Note: SWEEP_EPOCH_SAMPLE/FRAC (217/216), which radiod reports, are
|
|
2659
|
+
provisional until Phil assigns final numbers.
|
|
2638
2660
|
"""
|
|
2639
2661
|
_validate_ssrc(ssrc)
|
|
2640
|
-
|
|
2662
|
+
if duration_s is None:
|
|
2663
|
+
duration_s = period_s
|
|
2664
|
+
for nm, v in (("rate", rate_hz_per_s), ("period", period_s),
|
|
2665
|
+
("duration", duration_s), ("start", start_s)):
|
|
2666
|
+
if not isinstance(v, (int, float)) or isinstance(v, bool) or not math.isfinite(v):
|
|
2667
|
+
raise ValidationError(f"Sweep {nm} must be a finite number, got {v!r}")
|
|
2668
|
+
if rate_hz_per_s != 0 and not (0 < period_s <= 1e6):
|
|
2669
|
+
raise ValidationError(
|
|
2670
|
+
f"Sweep period must satisfy 0 < period <= 1e6 s with a nonzero rate, got {period_s}")
|
|
2671
|
+
if period_s < 0 or period_s > 1e6:
|
|
2672
|
+
raise ValidationError(f"Sweep period out of range [0, 1e6] s: {period_s}")
|
|
2673
|
+
if not (0 <= duration_s <= period_s):
|
|
2674
|
+
raise ValidationError(
|
|
2675
|
+
f"Sweep duration must satisfy 0 <= duration <= period ({period_s}), got {duration_s}")
|
|
2676
|
+
|
|
2641
2677
|
cmdbuffer = bytearray()
|
|
2642
2678
|
cmdbuffer.append(CMD)
|
|
2643
|
-
|
|
2644
|
-
encode_double(cmdbuffer, StatusType.
|
|
2645
|
-
encode_double(cmdbuffer, StatusType.
|
|
2679
|
+
encode_double(cmdbuffer, StatusType.SWEEP_RATE, float(rate_hz_per_s))
|
|
2680
|
+
encode_double(cmdbuffer, StatusType.SWEEP_DURATION, float(duration_s))
|
|
2681
|
+
encode_double(cmdbuffer, StatusType.SWEEP_PERIOD, float(period_s))
|
|
2682
|
+
encode_double(cmdbuffer, StatusType.SWEEP_START, float(start_s))
|
|
2646
2683
|
encode_int(cmdbuffer, StatusType.OUTPUT_SSRC, ssrc)
|
|
2647
2684
|
encode_int(cmdbuffer, StatusType.COMMAND_TAG, secrets.randbits(31))
|
|
2648
2685
|
encode_eol(cmdbuffer)
|
|
2649
|
-
|
|
2650
|
-
logger.info(f"Setting
|
|
2686
|
+
|
|
2687
|
+
logger.info(f"Setting sweep for SSRC {ssrc}: rate={rate_hz_per_s} Hz/s, "
|
|
2688
|
+
f"period={period_s} s, duration={duration_s} s, start={start_s} s")
|
|
2651
2689
|
self.send_command(cmdbuffer)
|
|
2652
|
-
|
|
2690
|
+
|
|
2653
2691
|
def set_pll(self, ssrc: int, enable: bool, bandwidth_hz: Optional[float] = None, square: bool = False):
|
|
2654
2692
|
"""
|
|
2655
2693
|
Configure PLL (Phase-Locked Loop) for carrier tracking in linear modes
|
|
@@ -3062,7 +3100,8 @@ class RadiodControl:
|
|
|
3062
3100
|
window_type: Optional[int] = None, avg: Optional[int] = None,
|
|
3063
3101
|
overlap: Optional[float] = None, base: Optional[float] = None,
|
|
3064
3102
|
step: Optional[float] = None, demod_type: Optional[int] = None,
|
|
3065
|
-
frequency_hz: Optional[float] = None
|
|
3103
|
+
frequency_hz: Optional[float] = None,
|
|
3104
|
+
lifetime: Optional[int] = None):
|
|
3066
3105
|
"""
|
|
3067
3106
|
Configure spectrum analyzer mode parameters.
|
|
3068
3107
|
|
|
@@ -3091,6 +3130,10 @@ class RadiodControl:
|
|
|
3091
3130
|
DemodType.SPECT_DEMOD or SPECT2_DEMOD) so a spectrum
|
|
3092
3131
|
channel can be created/retargeted with one command.
|
|
3093
3132
|
frequency_hz: Optional center frequency to set in the same packet.
|
|
3133
|
+
lifetime: Optional LIFETIME in radiod frames (~50/s), sent in the
|
|
3134
|
+
same packet; 0 = infinite. radiod never reaps a 0 Hz
|
|
3135
|
+
spectrum channel without one, so a client that dies before
|
|
3136
|
+
removing its channel leaks it. See set_channel_lifetime.
|
|
3094
3137
|
|
|
3095
3138
|
Example:
|
|
3096
3139
|
>>> control.set_spectrum(ssrc=12345, bin_bw_hz=100, bin_count=512,
|
|
@@ -3146,6 +3189,11 @@ class RadiodControl:
|
|
|
3146
3189
|
encode_float(cmdbuffer, StatusType.SPECTRUM_BASE, base)
|
|
3147
3190
|
if step is not None:
|
|
3148
3191
|
encode_float(cmdbuffer, StatusType.SPECTRUM_STEP, step)
|
|
3192
|
+
if lifetime is not None:
|
|
3193
|
+
if not isinstance(lifetime, int) or lifetime < 0:
|
|
3194
|
+
raise ValidationError(
|
|
3195
|
+
f"lifetime must be an int >= 0 (frames), got {lifetime!r}")
|
|
3196
|
+
encode_int(cmdbuffer, StatusType.LIFETIME, lifetime)
|
|
3149
3197
|
|
|
3150
3198
|
encode_int(cmdbuffer, StatusType.OUTPUT_SSRC, ssrc)
|
|
3151
3199
|
encode_int(cmdbuffer, StatusType.COMMAND_TAG, secrets.randbits(31))
|
|
@@ -3155,7 +3203,7 @@ class RadiodControl:
|
|
|
3155
3203
|
f"Setting spectrum for SSRC {ssrc}: bw={bin_bw_hz} Hz, "
|
|
3156
3204
|
f"bins={bin_count}, crossover={crossover_hz} Hz, "
|
|
3157
3205
|
f"window={window_type}, avg={avg}, overlap={overlap}, "
|
|
3158
|
-
f"base={base}, step={step}"
|
|
3206
|
+
f"base={base}, step={step}, lifetime={lifetime}"
|
|
3159
3207
|
)
|
|
3160
3208
|
self.send_command(cmdbuffer)
|
|
3161
3209
|
|
|
@@ -83,6 +83,10 @@ class _ChannelSlot:
|
|
|
83
83
|
pending_rtp_start: object = None # first-sample RTP of the pending batch
|
|
84
84
|
deliver_interval: int = 10
|
|
85
85
|
last_packet_time: float = 0.0
|
|
86
|
+
# Time of the last resequencer OUTPUT. Packets can keep arriving while
|
|
87
|
+
# nothing comes out (a wedged resequencer); raw receipt alone would
|
|
88
|
+
# call that slot healthy.
|
|
89
|
+
last_output_time: float = 0.0
|
|
86
90
|
dropped: bool = False
|
|
87
91
|
first_rtp_timestamp: Optional[int] = None
|
|
88
92
|
lifetime: Optional[int] = None
|
|
@@ -392,11 +396,15 @@ class MultiStream:
|
|
|
392
396
|
# Flush all resequencers
|
|
393
397
|
for ssrc, slot in self._slots.items():
|
|
394
398
|
try:
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
slot.
|
|
399
|
-
self.
|
|
399
|
+
# flush() stops before a STREAM_INTERRUPTION; each further
|
|
400
|
+
# call returns the next chunk, routed like live output.
|
|
401
|
+
for _ in range(len(slot.resequencer.buffer) + 1):
|
|
402
|
+
final_samples, final_gaps = slot.resequencer.flush()
|
|
403
|
+
self._route_output(slot, final_samples, final_gaps)
|
|
404
|
+
if not slot.resequencer.pending:
|
|
405
|
+
break
|
|
406
|
+
# Deliver the pending batch even when flush added nothing.
|
|
407
|
+
self._deliver(slot)
|
|
400
408
|
except Exception:
|
|
401
409
|
pass
|
|
402
410
|
|
|
@@ -487,6 +495,10 @@ class MultiStream:
|
|
|
487
495
|
continue
|
|
488
496
|
|
|
489
497
|
slot.last_packet_time = time.time()
|
|
498
|
+
# The first packet arms the output timer too, so a slot whose
|
|
499
|
+
# packets arrive but never come out still trips it.
|
|
500
|
+
if slot.last_output_time == 0.0:
|
|
501
|
+
slot.last_output_time = slot.last_packet_time
|
|
490
502
|
slot.quality.rtp_packets_received += 1
|
|
491
503
|
|
|
492
504
|
if slot.first_rtp_timestamp is None:
|
|
@@ -523,22 +535,37 @@ class MultiStream:
|
|
|
523
535
|
wallclock=wallclock,
|
|
524
536
|
)
|
|
525
537
|
output, gaps = slot.resequencer.process_packet(packet)
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
538
|
+
self._route_output(slot, output, gaps)
|
|
539
|
+
|
|
540
|
+
def _route_output(self, slot: _ChannelSlot, output, gaps) -> None:
|
|
541
|
+
"""Accumulate one resequencer emission into the slot's batch."""
|
|
542
|
+
if output is not None and len(output) > 0 and any(
|
|
543
|
+
g.source is GapSource.STREAM_INTERRUPTION for g in gaps):
|
|
544
|
+
# The resequencer could not fill this gap, and the chunk opens
|
|
545
|
+
# at the post-gap packet. Deliver what came before as its own
|
|
546
|
+
# batch, then re-base the anchor so that first_rtp_timestamp +
|
|
547
|
+
# total_samples_delivered still names the next sample's RTP.
|
|
548
|
+
self._deliver(slot)
|
|
549
|
+
rebased = (slot.resequencer.last_chunk_rtp_start
|
|
550
|
+
- slot.quality.total_samples_delivered) & 0xFFFFFFFF
|
|
551
|
+
slot.first_rtp_timestamp = rebased
|
|
552
|
+
slot.quality.first_rtp_timestamp = rebased
|
|
553
|
+
|
|
554
|
+
# Harvest gaps unconditionally, even from a call that produced no
|
|
555
|
+
# output; collecting only inside the branch below once discarded a
|
|
556
|
+
# radiod zero-block marker, and the stall went silent one layer
|
|
557
|
+
# further up.
|
|
558
|
+
slot.gap_buffer.extend(gaps)
|
|
559
|
+
|
|
560
|
+
if output is not None and len(output) > 0:
|
|
561
|
+
slot.last_output_time = time.time()
|
|
562
|
+
if not slot.sample_buffer:
|
|
563
|
+
slot.pending_rtp_start = slot.resequencer.last_chunk_rtp_start
|
|
564
|
+
slot.sample_buffer.append(output)
|
|
565
|
+
slot.packets_since_delivery += 1
|
|
566
|
+
|
|
567
|
+
if slot.packets_since_delivery >= slot.deliver_interval:
|
|
568
|
+
self._deliver(slot)
|
|
542
569
|
|
|
543
570
|
# ── encoding verification ──
|
|
544
571
|
|
|
@@ -662,7 +689,9 @@ class MultiStream:
|
|
|
662
689
|
slot.quality.delivered_rtp_start = slot.pending_rtp_start
|
|
663
690
|
|
|
664
691
|
try:
|
|
665
|
-
slot
|
|
692
|
+
# A copy: the slot's quality keeps changing (an interruption
|
|
693
|
+
# re-bases first_rtp_timestamp right after this delivery).
|
|
694
|
+
slot.on_samples(combined, slot.quality.copy())
|
|
666
695
|
except Exception:
|
|
667
696
|
logger.exception(
|
|
668
697
|
f"MultiStream: callback error for SSRC {slot.channel_info.ssrc}"
|
|
@@ -696,6 +725,14 @@ class MultiStream:
|
|
|
696
725
|
f"No packets for {silence:.1f}s "
|
|
697
726
|
f"(timeout: {self._drop_timeout_sec}s)",
|
|
698
727
|
)
|
|
728
|
+
elif (slot.last_output_time > 0 and
|
|
729
|
+
now - slot.last_output_time > self._drop_timeout_sec):
|
|
730
|
+
self._handle_drop(
|
|
731
|
+
ssrc, slot,
|
|
732
|
+
f"packets arriving but no output for "
|
|
733
|
+
f"{now - slot.last_output_time:.1f}s "
|
|
734
|
+
f"(timeout: {self._drop_timeout_sec}s)",
|
|
735
|
+
)
|
|
699
736
|
elif self._gap_storm(slot, check_interval):
|
|
700
737
|
self._handle_drop(
|
|
701
738
|
ssrc, slot,
|
|
@@ -772,6 +809,7 @@ class MultiStream:
|
|
|
772
809
|
slot.packets_since_delivery = 0
|
|
773
810
|
slot.last_gaps = 0
|
|
774
811
|
slot.gap_storm_secs = 0.0
|
|
812
|
+
slot.last_output_time = 0.0
|
|
775
813
|
|
|
776
814
|
logger.info(
|
|
777
815
|
f"MultiStream: {slot.frequency_hz/1e6:.3f} MHz restored "
|