qahw_api: increase sleep duration for 5sec to optimize power

- Close socket fd to fix test app hang issue and increase the poll
  time from 5msec to forever.
- Increase the sleep duration to 5sec to optimize power.

Change-Id: Ia3ce0121547d65617b52496b7cb6e37ef05c6ce3
This commit is contained in:
Surendar Karka 2019-02-11 13:18:53 +05:30 committed by Gerrit - the friendly Code Review server
parent 4323029d51
commit 809f69e677
1 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@ -135,6 +135,11 @@ typedef struct trnscode_loopback_config {
transcode_loopback_config_t g_trnscode_loopback_config;
static int poll_data_event_exit()
{
close(sock_event_fd);
}
void break_signal_handler(int signal __attribute__((unused)))
{
stop_loopback = true;
@ -492,9 +497,8 @@ void process_loopback_data(void *ptr)
fds.fd = sock_event_fd;
fds.events = POLLIN;
fds.revents = 0;
/* poll wait time modified from wait forever to 5 msec to
avoid keeping the thread in hang state */
i = poll(&fds, 1, 5);
/* poll wait time modified to wait forever */
i = poll(&fds, 1, -1);
if (i > 0 && (fds.revents & POLLIN)) {
count = recv(sock_event_fd, buffer, (64*1024), 0 );
@ -674,8 +678,8 @@ int main(int argc, char *argv[]) {
(void *) process_loopback_data, NULL);
fprintf(log_file,"\nMain thread loop\n");
while(!stop_loopback) {
usleep(100*1000);
play_duration_elapsed_msec += 100;
usleep(5000*1000);
play_duration_elapsed_msec += 5000;
if(play_duration_in_msec <= play_duration_elapsed_msec)
{
stop_loopback = true;
@ -686,6 +690,7 @@ int main(int argc, char *argv[]) {
fprintf(log_file,"\nMain thread loop exit\n");
exit_transcode_loopback_test:
poll_data_event_exit();
/* Wait for process thread to exit */
while (!exit_process_thread) {
usleep(10*1000);