Repository navigation
fix(audio): AAC/G.711 playback; docs: README in EN/RU/ZH, device report form - #6
Conversation
- AAC never started: the decoder was only created from playAudio(), which is fed by the PCM queue that stays empty for AAC. The decoder is now created on the first AAC packet. - mpeg4-generic (RFC 3640) was not recognised and was played as raw PCM. AU headers are now parsed using SizeLength/IndexLength from fmtp, and config= is passed as csd-0. ADTS payloads are split per frame. - closeAudio() shut down the AAC executor for good, so AAC could not restart after the first pause or camera switch. - G.711 (PCMU/PCMA) is decoded through lookup tables, including static payload types 0/8 without rtpmap. - Sample rate and channel count come from rtpmap and from the AAC output format; L16 stereo is supported. - Unsupported codecs (Opus, LATM, ...) are dropped instead of being played as noise. - The RTP header length now accounts for CSRC, extension and padding. - AudioTrack.Builder (API 23) is replaced with the API 21 constructor, so starting audio no longer crashes on Android 5.x (minSdk 21). - Only the playback thread writes to the AudioTrack. - Audio parameters move into AudioConfig.
PR Summary by QodoFix AAC playback and add G.711 audio decoding
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
1.
|
LICENSE.md and README already state Prosperity 3.0.0; the per-file headers still said MIT. Also adds a Device report issue form.
- Fix menu and quick-start descriptions to match the app (4 slots, Q, Settings = URL editor, no transport option, quality colours) - Add Download, Branches, Known limitations (linked to issues #7-#16), Building (debug without keys, CI behaviour), honest Security notes - Device list as a table with app version; cropped picture moved to #17 - Device report issue form link; README.ru.md and README.zh-CN.md with cross-links; tables padded for plain-text reading
- Recreate the AAC decoder on every RTSP (re)configure, so a reconnect with a different rate, channel count or config= is not fed to the old decoder. - Do not reset the AU-header layout in applyRtpmap(): fmtp may come before rtpmap in the SDP. - Disable AAC when SizeLength/IndexLength/IndexDeltaLength are outside 0..16, and only read AU headers that fit completely in the declared header bits. - Keep an access unit when no codec input buffer is free, and retry it instead of dropping it. - Drain codec output on idle iterations as well, so the last decoded frame is not held back until the next packet arrives.
|
Thanks @qodo — all 5 findings were valid and are fixed in f18fa67 (replies inline). On the high-level note about the CSRC/extension prefilter: audio arriving on interleaved channel 2 goes straight to |
Thanks for the clarification. Findings 1–5 are confirmed fixed in |
fix(audio): AAC/G.711 playback; docs: README in EN/RU/ZH, device report form
Problem
playAudio(), which reads the PCM queue. For AAC streams that queue stays empty, so the decoder was never created.mpeg4-generic(RFC 3640) was not recognised as AAC. The SDP check only looked forMP4A/AAC, so this audio went out as raw PCM, which is noise.closeAudio()calledshutdownNow()on the final executor. After the first pause or camera switch, starting AAC would throwRejectedExecutionException.AudioTrack.Builderneeds API 23, butminSdkis 21. Lint reported this asNewApi.Changes
AudioConfigclass with the audio parameters from the SDP: codec, PT, rate, channels,config=,SizeLength/IndexLength/IndexDeltaLength. Static PTs 0/8/10/11 work withoutrtpmap. Onlyrtpmap/fmtplines from the audio section are read.csd-0taken fromconfig=or built from the rate and channel count.RtspClient.rtpHeaderLength()/rtpPayloadEnd()account for CSRC, extension and padding. They are only used for audio for now.closeAudio()also clears the PCM queue.AudioTrackis created with the API 21 constructor.AudioManager.shutdown()is called inonDestroy.Verification
assembleDebugbuilds locally (AGP 8.13.1, SDK 36).lintDebug: 9 errors on v2, 3 on this branch; the remaining 3 predate it and are unrelated to audio.1188,1210,1588), AU-header bit reading, RTP header with CSRC/extension/padding, SDP parsing (mpeg4-generic + fmtp, static PCMA, a video and audio track with the same PT, Opus, no audio).Out of scope, coming in separate PRs: SETUP of a missing audio track,
a=control:*, video codec detection by PT.Also in this PR: documentation and license headers
README.ru.mdandREADME.zh-CN.mdcross-linked from the language bar.buglabel (Image is cropped at the edges on non-16:9 screens #17–Status overlay: "Disconnected" is hidden by a stale timer #26)..github/ISSUE_TEMPLATE/device_report.yml). It will appear in "New issue" once this PR is merged into the default branchv2.LICENSE.mdand the README.