← Back to team overview

rohc team mailing list archive

Re: [Question #214638]: Decompressor configuration when compressor is in an independent process

 

Question #214638 on rohc changed:
https://answers.launchpad.net/rohc/+question/214638

    Status: Answered => Open

Carlos is still having a problem:
Hi Didier,

Thank you very much for your answer. It really helped me to understand how to integrate the standalone feedback mode in my compression test. I am following the 4-step process you recommend in your message. However, I have some troubles decompressing packets. The decompressor fails to decompress every packet. An error message "no profile found for decompression" always displays . Am I forgetting anyhing? By the way, IP and no compresion modes are only enabled.
Below I include the code lines that initialize both compressor and decompressor.

Best regards,

Carlos


	/* Initialize entity's RoHC compressor. Suggestion: set max_cid = 15 */
	comp = rohc_alloc_compressor(max_cid, 0, 0, 0);
	if(comp == NULL)
	{
		fprintf(stderr, "cannot create the ROHC compressor\n");
		/* manage the error here */
	}

	/*
	 * Load selected profiles. List of supported modes below:
	rohc_activate_profile(comp, ROHC_PROFILE_UNCOMPRESSED);
	/* Uncompressed mode must always be enabled, in case compression is
	 * not possible */
	if(ROHC_profile != ROHC_PROFILE_UNCOMPRESSED)
		rohc_activate_profile(comp,ROHC_profile);

	/* Set MAX CID */
	rohc_c_set_large_cid(comp, 0);
	if(max_cid > 15)
	{
		rohc_c_set_large_cid(comp, 1);
		rohc_c_set_max_cid(comp, ROHC_LARGE_CID_MAX);
	}

	/* set the callback for random numbers */
	if(!rohc_comp_set_random_cb(comp, gen_random_num, NULL))
	{
		fprintf(stderr, "failed to set the callback for random numbers\n");
	}

decomp = rohc_alloc_decompressor(comp);
	if(decomp == NULL)
	{
	    fprintf(stderr, "cannot create the ROHC decompressor\n");
	    /* manage the error here */
	}

	/* set CID type and MAX_CID for decompressor */
	if(max_cid > 15)
	{
		if(!rohc_decomp_set_cid_type(decomp, ROHC_LARGE_CID))
		{
			fprintf(stderr, "failed to set CID type to large CIDs for "
					"decompressor\n");
		}
		if(!rohc_decomp_set_max_cid(decomp, ROHC_LARGE_CID_MAX))
		{
			fprintf(stderr, "failed to set MAX_CID to %d for "
					"decompressor\n", ROHC_LARGE_CID_MAX);
		}
	}
	else
	{
		if(!rohc_decomp_set_cid_type(decomp, ROHC_SMALL_CID))
		{
			fprintf(stderr, "failed to set CID type to small CIDs for "
					"decompressor\n");
		}
		if(!rohc_decomp_set_max_cid(decomp, ROHC_SMALL_CID_MAX))
		{
			fprintf(stderr, "failed to set MAX_CID to %d for "
					"decompressor\n", ROHC_SMALL_CID_MAX);
		}
	}


Following, the relevant code from the decompressor part:

	int ip_size = rohc_decompress(
			decomp,
			(u8*)(*sdu)->getDataField(),
			(*sdu)->get_packet_size(),
			ip_packet,
			MAXLENGTH
	);

	/*
	 * If the packet is not successfully uncompressed, the value of ip_size
	 * is negative. Manage the error and erase the pdu.
	 */
	if(ip_size < 0)
	{
		//TODO: error managing if needed. Have a look at all the possible negative values of ip_size
		//-------------------------------------------------

#ifdef DEBUG
		std::cout << "Packet decompression failed. Returned value = "
				<< ip_size << std::endl;
#endif
		/* Delete the SDU */
		delete *sdu;
		*sdu = NULL;
		return;
	}

	/* Send feedback to peer compressor */
	u8 feedback_buffer[MAXLENGTH];
	int feedback_size = rohc_feedback_flush(comp,feedback_buffer,MAXLENGTH);

	std::cout << "Feedback size = " << feedback_size << std::endl;
	if(feedback_size > 0)
	{
		Protocol_Packet* interspersed_pdu = new Protocol_Packet();
		interspersed_pdu->addDataBytes(feedback_buffer,feedback_size);

		/* Create interspersed ROHC feedback packet */
		addHeader(interspersed_pdu, PDCP_Control_PDU_interspersed, 0);	//SN deprecated here

		/* Deliver to peer */
		p_layer->generate_rlc_message(0, this->getRbId(), interspersed_pdu);

        }

-- 
You received this question notification because you are a member of ROHC
Team, which is an answer contact for rohc.