[pulseaudio-discuss] Are "_ref" and "_unref" not necessarily called in pairs?

Lin, Mengdong mengdong.lin at intel.com
Thu May 12 01:31:12 PDT 2011


For example, in file "module-suspend-on-idle.c ", why does the slot function "sink_input_state_changed_hook_cb" only reference the sink input but never unreference it?
So the reference count of the sink input will only increase? Does it matter?

Here is the code:
static pa_hook_result_t sink_input_state_changed_hook_cb(pa_core *c, pa_sink_input *s, struct userdata *u) {
    struct device_info *d;
    pa_sink_input_state_t state;

    pa_assert(c);
    pa_sink_input_assert_ref(s);  ... the sink input is referenced here. But where pa_sink_input_unref(s) is called?
    pa_assert(u);

    state = pa_sink_input_get_state(s);
    if (state == PA_SINK_INPUT_RUNNING || state == PA_SINK_INPUT_DRAINED)
        if ((d = pa_hashmap_get(u->device_infos, s->sink)))
            resume(d);

    return PA_HOOK_OK;
}


Thanks
Amanda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110512/fe110421/attachment.htm>


More information about the pulseaudio-discuss mailing list