From: Seungbae Shin Date: Mon, 11 Jul 2016 05:09:16 +0000 (+0900) Subject: Revise zero pop log messages X-Git-Tag: accepted/tizen/common/20160719.172001~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F23%2F79423%2F4;p=platform%2Fupstream%2Fpulseaudio.git Revise zero pop log messages 1. print only once per second. 2. skip check zero pop if virtual stream. [Version] 5.0-79 [Profile] All [Issue Type] MPR-381 Change-Id: I462044f106053ce3f48b3fe56cb845112e569987 --- diff --git a/packaging/pulseaudio.spec b/packaging/pulseaudio.spec index 3aa8ce7..421b69e 100644 --- a/packaging/pulseaudio.spec +++ b/packaging/pulseaudio.spec @@ -10,7 +10,7 @@ Name: pulseaudio Summary: Improved Linux sound server Version: 5.0 -Release: 78 +Release: 79 Group: Multimedia/Audio License: LGPL-2.1+ URL: http://pulseaudio.org diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index f7842b4..2602068 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -1785,28 +1785,37 @@ static bool sink_input_process_underrun_cb(pa_sink_input *i) { #ifdef __TIZEN__ static void _check_zero_pop_timeout(pa_sink_input *i) { - int zero_pop_seconds = 0; + uint32_t zero_pop_time = 0; playback_stream *s = PLAYBACK_STREAM(i->userdata); if (pa_memblockq_get_length(s->memblockq) == 0) { - if (i->initial_zero_pop_time) { - zero_pop_seconds = (int)((pa_rtclock_now() - i->initial_zero_pop_time) / PA_USEC_PER_SEC); - pa_log_debug("pop diff = %d sec., threshold = %d", zero_pop_seconds, i->core->zero_pop_threshold); - - if (zero_pop_seconds >= i->core->zero_pop_threshold) { - pa_log_info("async msgq post : PLAYBACK_STREAM_MESSAGE_POP_TIMEOUT"); - pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), - PLAYBACK_STREAM_MESSAGE_POP_TIMEOUT, NULL, 0, NULL, NULL); - i->initial_zero_pop_time = 0; + if (i->zero_pop_start_time) { + /* calculate zero pop time in seconds */ + zero_pop_time = (uint32_t)((pa_rtclock_now() - i->zero_pop_start_time) / PA_USEC_PER_SEC); + + /* check only once per seconds */ + if (zero_pop_time > i->old_zero_pop_time) { + pa_log_debug("zero pop (no sink-input data) for [%u] sec., timeout in [%u] sec.", + zero_pop_time, i->core->zero_pop_threshold); + + if (zero_pop_time >= i->core->zero_pop_threshold) { + pa_log_warn("async msgq post : PLAYBACK_STREAM_MESSAGE_POP_TIMEOUT"); + pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), + PLAYBACK_STREAM_MESSAGE_POP_TIMEOUT, NULL, 0, NULL, NULL); + i->zero_pop_start_time = 0; /* this will make reset count */ + } else { + i->old_zero_pop_time = zero_pop_time; + } } } else { - pa_log_debug("First zero pop"); - i->initial_zero_pop_time = pa_rtclock_now(); + pa_log_debug("zero pop start!!!"); + i->zero_pop_start_time = pa_rtclock_now(); + i->old_zero_pop_time = 0; } } else { - if (i->initial_zero_pop_time) { - pa_log_debug("Reset zero pop"); - i->initial_zero_pop_time = 0; + if (i->zero_pop_start_time) { + pa_log_debug("zero pop end..."); + i->zero_pop_start_time = 0; } } } @@ -1827,8 +1836,9 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk #ifdef __TIZEN__ /* If zero pops exceeds certain threshold, send message to client to handle this situation */ - /* FIXME: maybe we can use s->is_underrun to check.... */ - _check_zero_pop_timeout(i); + /* FIXME: maybe we can use s->is_underrun to check.... */ + if (!i->is_virtual) /* skip for virtual stream */ + _check_zero_pop_timeout(i); #endif if (!handle_input_underrun(s, false)) diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index d298c6c..2372a83 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -332,6 +332,9 @@ int pa_sink_input_new( char *pt; char *memblockq_name; pa_cvolume v; +#ifdef __TIZEN__ + char *media_name = NULL; +#endif pa_assert(_i); pa_assert(core); @@ -564,6 +567,11 @@ int pa_sink_input_new( i->userdata = NULL; #ifdef __TIZEN__ i->dump_fp = NULL; + + i->is_virtual = false; + media_name = pa_proplist_gets(i->proplist, PA_PROP_MEDIA_NAME); + if (media_name && pa_streq(media_name, "VIRTUAL_STREAM")) + i->is_virtual = true; #endif if (data->flags & PA_SINK_INPUT_START_RAMP_MUTED) pa_cvolume_ramp_int_init(&i->ramp, PA_VOLUME_MUTED, data->sink->sample_spec.channels); diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h index 3a512e9..8cd34dd 100644 --- a/src/pulsecore/sink-input.h +++ b/src/pulsecore/sink-input.h @@ -267,7 +267,9 @@ struct pa_sink_input { #ifdef __TIZEN__ FILE *dump_fp; - pa_usec_t initial_zero_pop_time; + pa_usec_t zero_pop_start_time; + uint32_t old_zero_pop_time; + bool is_virtual; #endif void *userdata;