Ejemplo n.º 1
0
/**
 * @brief Destroy the ts_sc_comp object
 *
 * @param ts_sc        The ts_sc_comp object to destroy
 */
void c_destroy_sc(struct ts_sc_comp *const ts_sc)
{
	assert(ts_sc != NULL);
	assert(ts_sc->ts_unscaled_wlsb != NULL);
	assert(ts_sc->ts_scaled_wlsb != NULL);
	c_destroy_wlsb(ts_sc->ts_unscaled_wlsb);
	c_destroy_wlsb(ts_sc->ts_scaled_wlsb);
}
Ejemplo n.º 2
0
//----------------------------------------------------------------------------------------------------------------------------------
// Free a context and the profile specific data within
// Param context: context to free
//----------------------------------------------------------------------------------------------------------------------------------
void context_free(struct sd_context * context)
{
	if(!context)
		return;

	context->profile->free_decode_data(context->data);

	c_destroy_wlsb(context->total_16_uncompressed);
	c_destroy_wlsb(context->total_16_compressed);
	c_destroy_wlsb(context->header_16_uncompressed);
	c_destroy_wlsb(context->header_16_compressed);

	kfree(context);
}
Ejemplo n.º 3
0
/**
 * @brief Create the ts_sc_comp object
 *
 * @param ts_sc              The ts_sc_comp object to create
 * @param wlsb_window_width  The width of the W-LSB sliding window to use
 *                           for TS_STRIDE (must be > 0)
 * @param trace_cb           The trace callback
 * @param trace_cb_priv      An optional private context for the trace
 *                           callback, may be NULL
 * @return                   true if creation is successful, false otherwise
 */
bool c_create_sc(struct ts_sc_comp *const ts_sc,
                 const size_t wlsb_window_width,
                 rohc_trace_callback2_t trace_cb,
                 void *const trace_cb_priv)
{
	assert(ts_sc != NULL);
	assert(wlsb_window_width > 0);

	ts_sc->ts_stride = 0;
	ts_sc->ts_scaled = 0;
	ts_sc->ts_offset = 0;
	ts_sc->old_ts = 0;
	ts_sc->ts = 0;
	ts_sc->ts_delta = 0;
	ts_sc->old_sn = 0;
	ts_sc->sn = 0;
	ts_sc->is_deducible = false;
	ts_sc->state = INIT_TS;
	ts_sc->are_old_val_init = false;
	ts_sc->nr_init_stride_packets = 0;

	ts_sc->trace_callback = trace_cb;
	ts_sc->trace_callback_priv = trace_cb_priv;

	/* W-LSB context for TS_SCALED */
	ts_sc->ts_scaled_wlsb = c_create_wlsb(32, wlsb_window_width,
	                                      ROHC_LSB_SHIFT_RTP_TS);
	if(ts_sc->ts_scaled_wlsb == NULL)
	{
		rohc_error(ts_sc, ROHC_TRACE_COMP, ROHC_PROFILE_GENERAL,
		           "cannot create a W-LSB window for TS_SCALED");
		goto error;
	}

	/* W-LSB context for unscaled TS */
	ts_sc->ts_unscaled_wlsb = c_create_wlsb(32, wlsb_window_width,
	                                        ROHC_LSB_SHIFT_RTP_TS);
	if(ts_sc->ts_unscaled_wlsb == NULL)
	{
		rohc_error(ts_sc, ROHC_TRACE_COMP, ROHC_PROFILE_GENERAL,
		           "cannot create a W-LSB window for unscaled TS");
		goto free_ts_scaled_wlsb;
	}

	return true;

free_ts_scaled_wlsb:
	c_destroy_wlsb(ts_sc->ts_scaled_wlsb);
error:
	return false;
}