mirror of
https://github.com/thegatesbrowser/godot-multiplayer.git
synced 2025-09-22 11:26:56 -04:00
fix dropped chunks
This commit is contained in:
parent
98a9578713
commit
19e287b098
1 changed files with 7 additions and 3 deletions
|
@ -56,7 +56,7 @@ func _process(_delta: float) -> void:
|
|||
|
||||
var accumulated_opusdata: Array[PackedByteArray] = []
|
||||
while opuschunked.chunk_available():
|
||||
if not Microphone.is_speaking:
|
||||
if not should_send_opus_data():
|
||||
opuschunked.drop_chunk()
|
||||
continue
|
||||
|
||||
|
@ -67,10 +67,14 @@ func _process(_delta: float) -> void:
|
|||
opuschunked.drop_chunk()
|
||||
accumulated_opusdata.append(opusdata)
|
||||
|
||||
if Microphone.is_speaking:
|
||||
if should_send_opus_data():
|
||||
rpc("opus_data_received", accumulated_opusdata)
|
||||
|
||||
|
||||
func should_send_opus_data() -> bool:
|
||||
return Microphone.is_speaking and Connection.is_peer_connected and not multiplayer.is_server()
|
||||
|
||||
|
||||
@rpc("any_peer", "call_remote", "unreliable_ordered", 1)
|
||||
func opus_data_received(opusdata_array: Array[PackedByteArray]) -> void:
|
||||
if multiplayer.is_server(): return
|
||||
|
@ -84,5 +88,5 @@ func print_audio_server_info() -> void:
|
|||
print("AudioServer:")
|
||||
print("Input device list: ", AudioServer.get_input_device_list())
|
||||
print("Output device list: ", AudioServer.get_output_device_list())
|
||||
print("Input mix rate: only available in Godot 4.4+")
|
||||
print("Input mix rate: ", AudioServer.get_input_mix_rate())
|
||||
print("Output mix rate: ", AudioServer.get_mix_rate())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue