diff options
| author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-11-14 17:27:16 -0300 | 
|---|---|---|
| committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-11-17 14:15:10 -0300 | 
| commit | 7ec871d37de442fd3731a0eef319851c61fb04cc (patch) | |
| tree | 069d1732958ede55f6e1821f653f1c6039e22c9c /audio | |
| parent | 204180c7dc2e20b9b701275a3fefb52707720f54 (diff) | |
Make use of g_timeout_add_seconds whenever possible.
Diffstat (limited to 'audio')
| -rw-r--r-- | audio/a2dp.c | 4 | ||||
| -rw-r--r-- | audio/avdtp.c | 22 | ||||
| -rw-r--r-- | audio/headset.c | 20 | ||||
| -rw-r--r-- | audio/sink.c | 6 | 
4 files changed, 30 insertions, 22 deletions
| diff --git a/audio/a2dp.c b/audio/a2dp.c index 8c38a90b..af0cfe4d 100644 --- a/audio/a2dp.c +++ b/audio/a2dp.c @@ -46,7 +46,7 @@  /* The duration that streams without users are allowed to stay in   * STREAMING state. */ -#define SUSPEND_TIMEOUT 5000 +#define SUSPEND_TIMEOUT 5  #define RECONFIGURE_TIMEOUT 500  #ifndef MIN @@ -610,7 +610,7 @@ static gboolean start_ind(struct avdtp *session, struct avdtp_local_sep *sep,  	if (!a2dp_sep->locked) {  		a2dp_sep->session = avdtp_ref(session); -		a2dp_sep->suspend_timer = g_timeout_add(SUSPEND_TIMEOUT, +		a2dp_sep->suspend_timer = g_timeout_add_seconds(SUSPEND_TIMEOUT,  						(GSourceFunc) suspend_timeout,  						a2dp_sep);  	} diff --git a/audio/avdtp.c b/audio/avdtp.c index 44d4c5ee..c1d8ed62 100644 --- a/audio/avdtp.c +++ b/audio/avdtp.c @@ -79,9 +79,9 @@  #define AVDTP_MSG_TYPE_ACCEPT			0x02  #define AVDTP_MSG_TYPE_REJECT			0x03 -#define REQ_TIMEOUT 4000 -#define DISCONNECT_TIMEOUT 5000 -#define STREAM_TIMEOUT 20000 +#define REQ_TIMEOUT 4 +#define DISCONNECT_TIMEOUT 5 +#define STREAM_TIMEOUT 20  typedef enum {  	AVDTP_SESSION_STATE_DISCONNECTED, @@ -508,8 +508,9 @@ static void set_disconnect_timer(struct avdtp *session)  	if (session->dc_timer)  		remove_disconnect_timer(session); -	session->dc_timer = g_timeout_add(DISCONNECT_TIMEOUT, -						disconnect_timeout, session); +	session->dc_timer = g_timeout_add_seconds(DISCONNECT_TIMEOUT, +						disconnect_timeout, +						session);  }  void avdtp_error_init(struct avdtp_error *err, uint8_t type, int id) @@ -703,7 +704,7 @@ static void avdtp_sep_set_state(struct avdtp *session,  	switch (state) {  	case AVDTP_STATE_OPEN:  		if (old_state > AVDTP_STATE_OPEN) -			stream->idle_timer = g_timeout_add(STREAM_TIMEOUT, +			stream->idle_timer = g_timeout_add_seconds(STREAM_TIMEOUT,  								stream_timeout,  								stream);  		break; @@ -1176,7 +1177,8 @@ static gboolean avdtp_open_cmd(struct avdtp *session, struct seid_req *req,  	stream->open_acp = TRUE;  	session->pending_open = stream; -	stream->timer = g_timeout_add(REQ_TIMEOUT, stream_open_timeout, +	stream->timer = g_timeout_add_seconds(REQ_TIMEOUT, +						stream_open_timeout,  						stream);  	return TRUE; @@ -1286,7 +1288,8 @@ static gboolean avdtp_close_cmd(struct avdtp *session, struct seid_req *req,  	if (!avdtp_send(session, rsp, sizeof(struct gen_resp)))  		return FALSE; -	stream->timer = g_timeout_add(REQ_TIMEOUT, stream_close_timeout, +	stream->timer = g_timeout_add_seconds(REQ_TIMEOUT, +					stream_close_timeout,  					stream);  	return TRUE; @@ -1775,7 +1778,8 @@ static int send_req(struct avdtp *session, gboolean priority,  	session->req = req; -	req->timeout = g_timeout_add(REQ_TIMEOUT, request_timeout, +	req->timeout = g_timeout_add_seconds(REQ_TIMEOUT, +					request_timeout,  					session);  	return 0; diff --git a/audio/headset.c b/audio/headset.c index c7428aac..039d627a 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -62,9 +62,9 @@  #include "../src/adapter.h"  #include "../src/device.h" -#define DC_TIMEOUT 3000 +#define DC_TIMEOUT 3 -#define RING_INTERVAL 3000 +#define RING_INTERVAL 3  #define BUF_SIZE 1024 @@ -551,7 +551,8 @@ static void sco_connect_cb(GIOChannel *chan, int err, const bdaddr_t *src,  	if (hs->pending_ring) {  		ring_timer_cb(NULL); -		ag.ring_timer = g_timeout_add(RING_INTERVAL, ring_timer_cb, +		ag.ring_timer = g_timeout_add_seconds(RING_INTERVAL, +						ring_timer_cb,  						NULL);  		hs->pending_ring = FALSE;  	} @@ -1529,7 +1530,8 @@ static DBusMessage *hs_ring(DBusConnection *conn, DBusMessage *msg,  	}  	ring_timer_cb(NULL); -	ag.ring_timer = g_timeout_add(RING_INTERVAL, ring_timer_cb, NULL); +	ag.ring_timer = g_timeout_add_seconds(RING_INTERVAL, ring_timer_cb, +						NULL);  done:  	return reply; @@ -2087,7 +2089,7 @@ gboolean headset_cancel_stream(struct audio_device *dev, unsigned int id)  	if (hs->auto_dc) {  		if (hs->rfcomm) -			hs->dc_timer = g_timeout_add(DC_TIMEOUT, +			hs->dc_timer = g_timeout_add_seconds(DC_TIMEOUT,  						(GSourceFunc) hs_dc_timeout,  						dev);  		else @@ -2171,7 +2173,8 @@ int headset_connect_sco(struct audio_device *dev, GIOChannel *io)  	if (hs->pending_ring) {  		ring_timer_cb(NULL); -		ag.ring_timer = g_timeout_add(RING_INTERVAL, ring_timer_cb, +		ag.ring_timer = g_timeout_add_seconds(RING_INTERVAL, +						ring_timer_cb,  						NULL);  		hs->pending_ring = FALSE;  	} @@ -2354,7 +2357,7 @@ gboolean headset_unlock(struct audio_device *dev, headset_lock_t lock)  	if (hs->auto_dc) {  		if (hs->state == HEADSET_STATE_CONNECTED) -			hs->dc_timer = g_timeout_add(DC_TIMEOUT, +			hs->dc_timer = g_timeout_add_seconds(DC_TIMEOUT,  						(GSourceFunc) hs_dc_timeout,  						dev);  		else @@ -2455,7 +2458,8 @@ int telephony_incoming_call_ind(const char *number, int type)  	}  	ring_timer_cb(NULL); -	ag.ring_timer = g_timeout_add(RING_INTERVAL, ring_timer_cb, NULL); +	ag.ring_timer = g_timeout_add_seconds(RING_INTERVAL, ring_timer_cb, +						NULL);  	return 0;  } diff --git a/audio/sink.c b/audio/sink.c index ea8570ac..9c72c5f1 100644 --- a/audio/sink.c +++ b/audio/sink.c @@ -44,7 +44,7 @@  #include "sink.h"  #include "dbus-common.h" -#define STREAM_SETUP_RETRY_TIMER 2000 +#define STREAM_SETUP_RETRY_TIMER 2  struct pending_request {  	DBusConnection *conn; @@ -201,7 +201,7 @@ static void stream_setup_complete(struct avdtp *session, struct a2dp_sep *sep,  		if (avdtp_error_type(err) == AVDTP_ERROR_ERRNO  				&& avdtp_error_posix_errno(err) != EHOSTDOWN) {  			debug("connect:connect XCASE detected"); -			g_timeout_add(STREAM_SETUP_RETRY_TIMER, +			g_timeout_add_seconds(STREAM_SETUP_RETRY_TIMER,  					stream_setup_retry, sink);  		} else {  			sink->connect = NULL; @@ -366,7 +366,7 @@ static void discovery_complete(struct avdtp *session, GSList *seps, struct avdtp  		if (avdtp_error_type(err) == AVDTP_ERROR_ERRNO  				&& avdtp_error_posix_errno(err) != EHOSTDOWN) {  			debug("connect:connect XCASE detected"); -			g_timeout_add(STREAM_SETUP_RETRY_TIMER, +			g_timeout_add_seconds(STREAM_SETUP_RETRY_TIMER,  					stream_setup_retry, sink);  		} else  			goto failed; | 
