Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SteamP2PCodec.cpp #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update SteamP2PCodec.cpp #24

wants to merge 1 commit into from

Conversation

anzz1
Copy link

@anzz1 anzz1 commented Feb 10, 2025

  • differentiate voice packets by adding id (+ 0-31)
  • send correct samplerate

Purpose

Add the client id (0-31) to the lowpart of "steamid" in the voice packet, so the voice packets can be differentiated from each other.
This is likely how steam handles decoding separate audio streams with their own decoder states, and sending everything with same id breaks this.
Also set the samplerate packet to send 8000 to match reality (even though neither opus nor silk use it so it shouldn't really affect anything)

Open Questions and Pre-Merge TODOs

The above part is mere speculation how the audio stream separation is handled is merely an educated guess, as the steam API func DecompressVoice does not have any knowledge of internal game state. The Voice_AddIncomingData function that calls it knows which of the five available voice channels the current audio stream is on, but this isn't passed into steam api.
So unless the steam client accesses the game's memory, the only way the api func can differentiate voice packets is by using the information in the packet itself, i.e. the "steamid". This is why its an "educated" guess, but it still is a guess and not confirmed that it is actually how it works.

That all being said, it doesn't exactly hurt either to send the packets with different ids so even if the decoders are not separated like they should and the steamid isnt used.

- differentiate voice packets by adding id
- send correct samplerate
@stamepicmorg stamepicmorg added Status: 👀 needs review Requires code or changes review. Priority: 🕒 low Low priority tasks that can be postponed for the future. Type: 🛠️ refactor Refactoring code without adding new functionality. Difficulty: 🟡 medium Task of medium difficulty requiring moderate effort. OS: 💻 Independent Case do not refer to any OS. Engine: 📀 reHLDS Case refers to reHLDS engine. labels Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: 🟡 medium Task of medium difficulty requiring moderate effort. Engine: 📀 reHLDS Case refers to reHLDS engine. OS: 💻 Independent Case do not refer to any OS. Priority: 🕒 low Low priority tasks that can be postponed for the future. Status: 👀 needs review Requires code or changes review. Type: 🛠️ refactor Refactoring code without adding new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants