Repository navigation
Conversation
When reading the OpusHead packet, OpusParser stored the channel mode in packet_count instead of channel_mode. For a mono stream this set packet_count back to 0 (ChannelMode.MONO), so the OpusTags packet was then checked as the identification header and the parser raised "first packet is not OpusHead". Stereo streams only worked because ChannelMode.STEREO happens to be 1, and channel_mode always stayed STEREO.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bumble-player, and anything else that reads Ogg Opus files witha2dp.OpusParser, cannot use a mono file: parsing stops withValueError: first packet is not OpusHead, so the mono branch in the player'sopus_codec_capabilitiesis never reached.Root cause
When
OpusParser.packetsreads the OpusHead packet, it stores the channel mode inpacket_countinstead ofchannel_mode:For a mono stream this sets
packet_countback to 0 (ChannelMode.MONO), so the next packet (OpusTags) is checked again as the identification header and the parser raises. Stereo streams only work becauseChannelMode.STEREOhappens to be 1, andchannel_modealways keeps its initialSTEREOvalue.Fix
Assign the value to
channel_mode.Test
test_opus_parser_monointests/a2dp_test.pyfeeds a one page Ogg stream with a 1 channel OpusHead, an OpusTags packet and one audio packet, and checks that the parser yields a singleMONOpacket with the audio payload. It fails before the change with theValueErrorabove and passes after it. The existing stereo tests still pass, andblack -S --checkis clean on the changed files.