Esempio n. 1
0
static int32_t
rtp_sinker_consumable(network_sinker *ns, proto_watch *pw,
                      int32_t stm_i, uint32_t size)
{
    int32_t err = -EINVAL;
    media_sinker *sinker = (media_sinker*)ns;
    rtp_sinker *rs = (rtp_sinker*)ns;
    network_client *nc = (network_client*)rs->interleaved;

    if (rs->trans_mode == RTP_OVER_RTSP && nc)
    {   //@{Interleaved rtp mode}
        client_ref((client*)nc);
        RELEASE_LOCK(sinker->lock);

        err = network_client_consumable(nc, size);
        client_unref((client*)nc);

        AQUIRE_LOCK(sinker->lock);
        return err;
    }

    if (pw)
    {
        return proto_watch_writeable(pw, size);
    }

    return err;
}
Esempio n. 2
0
int32_t
network_client_consumable(network_client *nc, uint32_t size)
{
	int32_t err = -EKILLED;
	proto_watch *pw = NULL;

	pthread_mutex_lock(nc->lock);
	if (!__network_client_killed(nc))
	{
		pw = proto_watch_ref(nc->proto_watch);
	}
	pthread_mutex_unlock(nc->lock);

	if (pw)
	{
		err = proto_watch_writeable(pw, size);
		proto_watch_unref(pw);
	}

	return err;
}