ka9q-python 3.27.0__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.
Files changed (151) hide show
  1. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/CHANGELOG.md +94 -0
  2. {ka9q_python-3.27.0/ka9q_python.egg-info → ka9q_python-3.29.0}/PKG-INFO +1 -1
  3. ka9q_python-3.29.0/docs/INDEX.md +28 -0
  4. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/control.py +12 -2
  5. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/multi_stream.py +60 -22
  6. ka9q_python-3.29.0/ka9q/resequencer.py +696 -0
  7. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/spectrum_stream.py +35 -3
  8. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/stream.py +49 -21
  9. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/stream_quality.py +9 -2
  10. {ka9q_python-3.27.0 → ka9q_python-3.29.0/ka9q_python.egg-info}/PKG-INFO +1 -1
  11. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q_python.egg-info/SOURCES.txt +2 -0
  12. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/pyproject.toml +1 -1
  13. ka9q_python-3.29.0/tests/test_resequencer_accounting.py +944 -0
  14. ka9q_python-3.29.0/tests/test_set_spectrum.py +223 -0
  15. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_zero_block_detection.py +14 -6
  16. ka9q_python-3.27.0/ka9q/resequencer.py +0 -452
  17. ka9q_python-3.27.0/tests/test_set_spectrum.py +0 -128
  18. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/LICENSE +0 -0
  19. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/MANIFEST.in +0 -0
  20. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/README.md +0 -0
  21. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/API_REFERENCE.md +0 -0
  22. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/ARCHITECTURE.md +0 -0
  23. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/CLI_GUIDE.md +0 -0
  24. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/GETTING_STARTED.md +0 -0
  25. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/INSTALLATION.md +0 -0
  26. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/MULTI_STREAM.md +0 -0
  27. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/POLL-SUPPRESSION-DESIGN.md +0 -0
  28. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/RECIPES.md +0 -0
  29. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/REQUIREMENTS.md +0 -0
  30. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/RTP_TIMING_SUPPORT.md +0 -0
  31. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/SECURITY.md +0 -0
  32. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/TESTING_GUIDE.md +0 -0
  33. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/TUI_GUIDE.md +0 -0
  34. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/README.md +0 -0
  35. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/clients.md +0 -0
  36. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/contract.md +0 -0
  37. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/control-surface.md +0 -0
  38. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/findings.md +0 -0
  39. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/idempotency.md +0 -0
  40. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/audit/2026-08-12-alignment/upstream.md +0 -0
  41. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/superpowers/plans/2026-08-12-upstream-alignment-and-client-compat.md +0 -0
  42. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/superpowers/plans/2026-08-13-audit-remediation.md +0 -0
  43. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/superpowers/plans/2026-08-13-client-side-fixes.md +0 -0
  44. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/docs/superpowers/specs/2026-08-12-upstream-alignment-and-client-compat-design.md +0 -0
  45. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/advanced_features_demo.py +0 -0
  46. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/channel_cleanup_example.py +0 -0
  47. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/codar_oceanography.py +0 -0
  48. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/diagnostics/diagnose_packets.py +0 -0
  49. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/diagnostics/repro_utc_bug.py +0 -0
  50. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/discover_example.py +0 -0
  51. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/grape_integration_example.py +0 -0
  52. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/hf_band_scanner.py +0 -0
  53. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/multi_stream_smoke.py +0 -0
  54. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/rtp_recorder_example.py +0 -0
  55. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/simple_am_radio.py +0 -0
  56. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/spectrum_example.py +0 -0
  57. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/stream_example.py +0 -0
  58. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/superdarn_recorder.py +0 -0
  59. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/test_channel_operations.py +0 -0
  60. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/test_improvements.py +0 -0
  61. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/test_timing_fields.py +0 -0
  62. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/tune.py +0 -0
  63. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/examples/tune_example.py +0 -0
  64. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/__init__.py +0 -0
  65. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/_multicast.py +0 -0
  66. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/addressing.py +0 -0
  67. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/cli.py +0 -0
  68. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/compat.py +0 -0
  69. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/discovery.py +0 -0
  70. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/exceptions.py +0 -0
  71. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/managed_stream.py +0 -0
  72. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/monitor.py +0 -0
  73. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/pps_calibrator.py +0 -0
  74. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/recovery_ladder.py +0 -0
  75. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/rtp_recorder.py +0 -0
  76. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/slot_clock.py +0 -0
  77. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/status.py +0 -0
  78. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/status_listener.py +0 -0
  79. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/tui.py +0 -0
  80. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/types.py +0 -0
  81. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q/utils.py +0 -0
  82. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q_python.egg-info/dependency_links.txt +0 -0
  83. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q_python.egg-info/entry_points.txt +0 -0
  84. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q_python.egg-info/requires.txt +0 -0
  85. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q_python.egg-info/top_level.txt +0 -0
  86. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/ka9q_radio_compat +0 -0
  87. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/scripts/check_upstream_drift.py +0 -0
  88. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/scripts/gen_client_manifest.py +0 -0
  89. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/scripts/sync_types.py +0 -0
  90. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/setup.cfg +0 -0
  91. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/__init__.py +0 -0
  92. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/conftest.py +0 -0
  93. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_addressing.py +0 -0
  94. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_channel_verification.py +0 -0
  95. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_client_contract.py +0 -0
  96. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_client_id_destination.py +0 -0
  97. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_compat_pin_reachability.py +0 -0
  98. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_create_split_encoding.py +0 -0
  99. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_decode_description.py +0 -0
  100. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_decode_functions.py +0 -0
  101. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_delivered_rtp_start.py +0 -0
  102. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_destination_required.py +0 -0
  103. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_encode_functions.py +0 -0
  104. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_encode_socket.py +0 -0
  105. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_ensure_channel_encoding.py +0 -0
  106. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_filter_edges.py +0 -0
  107. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_gen_client_manifest.py +0 -0
  108. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_idempotency_integration.py +0 -0
  109. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_integration.py +0 -0
  110. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_iq_20khz_f32.py +0 -0
  111. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_keepalive_encoding.py +0 -0
  112. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_lifetime.py +0 -0
  113. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_listen_multicast.py +0 -0
  114. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_managed_stream_recovery.py +0 -0
  115. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_monitor.py +0 -0
  116. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_multicast_helpers.py +0 -0
  117. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_multihomed.py +0 -0
  118. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_multistream_completeness.py +0 -0
  119. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_multistream_gap_storm.py +0 -0
  120. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_multistream_prune.py +0 -0
  121. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_multistream_restore.py +0 -0
  122. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_native_discovery.py +0 -0
  123. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_parameter_vector.py +0 -0
  124. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_parse_rtp_samples_iq.py +0 -0
  125. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_performance_fixes.py +0 -0
  126. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_poll_channel_idle.py +0 -0
  127. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_protocol_compat.py +0 -0
  128. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_recovery_ladder.py +0 -0
  129. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_remove_channel.py +0 -0
  130. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_rtp_recorder.py +0 -0
  131. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_rtp_to_wallclock_deprecated.py +0 -0
  132. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_security_features.py +0 -0
  133. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_set_demod_type.py +0 -0
  134. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_set_lock_warns.py +0 -0
  135. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_slot_clock.py +0 -0
  136. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_spectrum.py +0 -0
  137. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_ssrc_dest_unit.py +0 -0
  138. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_ssrc_encoding_unit.py +0 -0
  139. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_ssrc_radiod_host_unit.py +0 -0
  140. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_status_decoder.py +0 -0
  141. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_status_listener.py +0 -0
  142. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_status_socket_drain.py +0 -0
  143. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_sweep.py +0 -0
  144. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_sync_types.py +0 -0
  145. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_ttl_warning.py +0 -0
  146. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_tune.py +0 -0
  147. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_tune_cli.py +0 -0
  148. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_tune_debug.py +0 -0
  149. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_tune_live.py +0 -0
  150. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_tune_method.py +0 -0
  151. {ka9q_python-3.27.0 → ka9q_python-3.29.0}/tests/test_upstream_drift.py +0 -0
@@ -1,5 +1,99 @@
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
+
3
97
  ## 3.27.0 (2026-11-11)
4
98
 
5
99
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ka9q-python
3
- Version: 3.27.0
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
@@ -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) |
@@ -3100,7 +3100,8 @@ class RadiodControl:
3100
3100
  window_type: Optional[int] = None, avg: Optional[int] = None,
3101
3101
  overlap: Optional[float] = None, base: Optional[float] = None,
3102
3102
  step: Optional[float] = None, demod_type: Optional[int] = None,
3103
- frequency_hz: Optional[float] = None):
3103
+ frequency_hz: Optional[float] = None,
3104
+ lifetime: Optional[int] = None):
3104
3105
  """
3105
3106
  Configure spectrum analyzer mode parameters.
3106
3107
 
@@ -3129,6 +3130,10 @@ class RadiodControl:
3129
3130
  DemodType.SPECT_DEMOD or SPECT2_DEMOD) so a spectrum
3130
3131
  channel can be created/retargeted with one command.
3131
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.
3132
3137
 
3133
3138
  Example:
3134
3139
  >>> control.set_spectrum(ssrc=12345, bin_bw_hz=100, bin_count=512,
@@ -3184,6 +3189,11 @@ class RadiodControl:
3184
3189
  encode_float(cmdbuffer, StatusType.SPECTRUM_BASE, base)
3185
3190
  if step is not None:
3186
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)
3187
3197
 
3188
3198
  encode_int(cmdbuffer, StatusType.OUTPUT_SSRC, ssrc)
3189
3199
  encode_int(cmdbuffer, StatusType.COMMAND_TAG, secrets.randbits(31))
@@ -3193,7 +3203,7 @@ class RadiodControl:
3193
3203
  f"Setting spectrum for SSRC {ssrc}: bw={bin_bw_hz} Hz, "
3194
3204
  f"bins={bin_count}, crossover={crossover_hz} Hz, "
3195
3205
  f"window={window_type}, avg={avg}, overlap={overlap}, "
3196
- f"base={base}, step={step}"
3206
+ f"base={base}, step={step}, lifetime={lifetime}"
3197
3207
  )
3198
3208
  self.send_command(cmdbuffer)
3199
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
- final_samples, final_gaps = slot.resequencer.flush()
396
- if final_samples is not None and len(final_samples) > 0:
397
- slot.sample_buffer.append(final_samples)
398
- slot.gap_buffer.extend(final_gaps)
399
- self._deliver(slot)
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
- # Harvest gaps unconditionally. A radiod zero-block marker
528
- # can be reported for a packet that produced no output yet
529
- # (arrived out of order and is still buffered); collecting
530
- # only inside the branch below discarded it, and the stall
531
- # went silent one layer further up.
532
- slot.gap_buffer.extend(gaps)
533
-
534
- if output is not None and len(output) > 0:
535
- if not slot.sample_buffer:
536
- slot.pending_rtp_start = slot.resequencer.last_chunk_rtp_start
537
- slot.sample_buffer.append(output)
538
- slot.packets_since_delivery += 1
539
-
540
- if slot.packets_since_delivery >= slot.deliver_interval:
541
- self._deliver(slot)
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.on_samples(combined, slot.quality)
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 "