Use double for calculating duration.
This commit is contained in:
parent
19de4b2187
commit
fccec2e5e4
@ -86,7 +86,7 @@ void audio_stream_begin(audio_stream* audio, int rate, int channels, int bps) {
|
|||||||
|
|
||||||
void audio_stream_end(audio_stream* audio) {
|
void audio_stream_end(audio_stream* audio) {
|
||||||
|
|
||||||
int duration;
|
double duration;
|
||||||
|
|
||||||
rdp_guac_client_data* data = (rdp_guac_client_data*) audio->client->data;
|
rdp_guac_client_data* data = (rdp_guac_client_data*) audio->client->data;
|
||||||
|
|
||||||
@ -95,9 +95,8 @@ void audio_stream_end(audio_stream* audio) {
|
|||||||
audio->encoder->end_handler(audio);
|
audio->encoder->end_handler(audio);
|
||||||
|
|
||||||
/* Calculate duration of PCM data */
|
/* Calculate duration of PCM data */
|
||||||
duration =
|
duration = ((double) (audio->pcm_bytes_written * 1000 * 8))
|
||||||
audio->pcm_bytes_written * 1000 * 8 / audio->rate
|
/ audio->rate / audio->channels / audio->bps;
|
||||||
/ audio->channels / audio->bps;
|
|
||||||
|
|
||||||
pthread_mutex_lock(&(data->update_lock));
|
pthread_mutex_lock(&(data->update_lock));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user