Small audio related updates

This commit is contained in:
WolverinDEV 2020-04-18 00:05:39 +02:00
parent d7fa67b0aa
commit 6393d79f54
6 changed files with 16 additions and 10 deletions

2
github

@ -1 +1 @@
Subproject commit 2af3e5879d9c5435896812710d1216df2d87c713
Subproject commit eb310aa0eafd254324a6f921f1c055c664bf48cc

View File

@ -65,9 +65,6 @@ class ErrorCommandHandler extends AbstractCommandHandler {
return_listener["_clientinit"](new CommandResult({id: 0, message: ""}));
delete return_listener["_clientinit"];
}
if(this._handle.onconnectionstatechanged)
this._handle.onconnectionstatechanged(ConnectionState.INITIALISING, ConnectionState.CONNECTING);
} else if(command.command == "notifyconnectioninforequest") {
this._handle.send_command("setconnectioninfo",
{
@ -171,6 +168,8 @@ export class ServerConnection extends AbstractServerConnection {
}
connect(address: ServerAddress, handshake: HandshakeHandler, timeout?: number): Promise<void> {
this.updateConnectionState(ConnectionState.CONNECTING);
this._remote_address = address;
this._handshake_handler = handshake;
this._do_teamspeak = false;
@ -189,11 +188,13 @@ export class ServerConnection extends AbstractServerConnection {
if(error != 0) {
/* required to notify the handle, just a promise reject does not work */
this.client.handleDisconnect(DisconnectReason.CONNECT_FAILURE, error);
this.updateConnectionState(ConnectionState.UNCONNECTED);
reject(this._native_handle.error_message(error));
return;
} else {
resolve();
}
this.updateConnectionState(ConnectionState.AUTHENTICATING);
console.log("Remote server type: %o (%s)", this._native_handle.server_type, ServerType[this._native_handle.server_type]);
if(this._native_handle.server_type == ServerType.TEAMSPEAK || this._do_teamspeak) {

View File

@ -1,4 +1,4 @@
//FIXME!
//FIXME: This works in general, but is not a good thing
namespace native {
const remote = require('electron').remote;
export async function client_version() : Promise<string> {

View File

@ -24,8 +24,8 @@ function(setup_nodejs)
set(NODEJS_URL "https://atom.io/download/atom-shell")
set(NODEJS_VERSION "v8.0.0")
set(NODEJS_URL "https://nodejs.org/download/release/")
set(NODEJS_VERSION "v12.13.0")
#set(NODEJS_URL "https://nodejs.org/download/release/")
#set(NODEJS_VERSION "v12.13.0")
find_package(NodeJS REQUIRED)

View File

@ -465,7 +465,7 @@ void VoiceClient::event_execute(const std::chrono::system_clock::time_point &sch
assert(!replay_head); /* could not be set, else prv_head would be set */
//No packet found here, test if we've more than n packets in a row somewhere
#define SKIP_SEQ_LENGTH (1)
#define SKIP_SEQ_LENGTH (3)
EncodedBuffer* skip_ptr[SKIP_SEQ_LENGTH + 1];
memset(skip_ptr, 0, sizeof(skip_ptr));
skip_ptr[0] = audio_codec.pending_buffers;
@ -484,7 +484,7 @@ void VoiceClient::event_execute(const std::chrono::system_clock::time_point &sch
}
if(skip_ptr[SKIP_SEQ_LENGTH]) {
/* we've tree packets in a row */
/* we've three packets in a row */
replay_head = audio_codec.pending_buffers;
audio_codec.pending_buffers = skip_ptr[SKIP_SEQ_LENGTH];
skip_ptr[SKIP_SEQ_LENGTH - 1]->next = nullptr;
@ -542,6 +542,8 @@ void VoiceClient::event_execute(const std::chrono::system_clock::time_point &sch
if(replay_head->buffer.empty()) {
this->set_state(state::stopping);
log_debug(category::voice_connection, tr("Client {} send a stop signal. Flushing stream and stopping"), this->_client_id);
} else if(local_last_pid > replay_head->packet_id) {
log_debug(category::voice_connection, tr("Client {} tried to replay too old voice chunk. Current id is {}, attempted chunk id is {}. Dropping buffer."), this->_client_id, local_last_pid, replay_head->packet_id);
} else {
auto lost_packets = packet_id_diff(local_last_pid, replay_head->packet_id) - 1;
if(lost_packets > 6) {
@ -567,7 +569,10 @@ void VoiceClient::event_execute(const std::chrono::system_clock::time_point &sch
}
local_last_pid = replay_head->packet_id;
auto last_head = replay_head;
replay_head = replay_head->next;
delete last_head;
}
lock.lock(); //Check for more packets
//TODO: Check for timeout?

View File

@ -1,6 +1,6 @@
{
"name": "TeaClient",
"version": "1.4.5",
"version": "1.4.5-2",
"description": "",
"main": "main.js",
"scripts": {