diff --git a/src/protocols/rdp/audio_input.c b/src/protocols/rdp/audio_input.c index eefb231b..dc078dc0 100644 --- a/src/protocols/rdp/audio_input.c +++ b/src/protocols/rdp/audio_input.c @@ -247,9 +247,6 @@ void guac_rdp_audio_buffer_set_stream(guac_rdp_audio_buffer* audio_buffer, audio_buffer->in_format.channels = channels; audio_buffer->in_format.bps = bps; - /* Reset input counter */ - audio_buffer->total_bytes_received = 0; - /* Acknowledge stream creation (if buffer is ready to receive) */ guac_rdp_audio_buffer_ack(audio_buffer, "OK", GUAC_PROTOCOL_STATUS_SUCCESS); @@ -274,9 +271,6 @@ void guac_rdp_audio_buffer_set_output(guac_rdp_audio_buffer* audio_buffer, audio_buffer->out_format.channels = channels; audio_buffer->out_format.bps = bps; - /* Reset output counter */ - audio_buffer->total_bytes_sent = 0; - pthread_mutex_unlock(&(audio_buffer->lock)); } @@ -470,6 +464,10 @@ void guac_rdp_audio_buffer_end(guac_rdp_audio_buffer* audio_buffer) { audio_buffer->packet_size = 0; audio_buffer->flush_handler = NULL; + /* Reset I/O counters */ + audio_buffer->total_bytes_sent = 0; + audio_buffer->total_bytes_received = 0; + /* Free packet (if any) */ free(audio_buffer->packet); audio_buffer->packet = NULL;