c_get_profile_from_id

Asked by Friedrich on 2014-03-28

Hi,

At 1.6.1, I am a little confused at the line in rohc_comp.c:
/* get uncompressed profile */
  p = c_get_profile_from_id(comp, ROHC_PROFILE_UNCOMPRESSED);
since
// The number allocated for the ROHC Uncompressed profile (RFC 3095, 5.10)
#define ROHC_PROFILE_UNCOMPRESSED 0x0000
/// The number allocated for the ROHC RTP profile (RFC 3095, 8)
#define ROHC_PROFILE_RTP 0x0001

Do I need to change it to ROHC_PROFILE_RTP for RTP compression if I have already known the transmission is RTP?

Also,
check_profile = c_profiles[i]->check_profile(comp, outer_ip, inner_ip, protocol, pkt_key);

I always get bool check_profile=0. So that it was shown that skip profile 'RTP / Compressor' (0x0001) because it does not match packet. I didn't find how check_profile() worked to return 0. If I do, I would like it to return 1 for RTP.

Thanks!

Question information

Language:
English Edit question
Status:
Answered
For:
rohc Edit question
Assignee:
No assignee Edit question
Last query:
2014-03-31
Last reply:
2014-04-06

Hello,

You don't need to modify the source code of the library to detect RTP streams. You have two ways to do it:

1/ static list of UDP ports

You give the ROHC compressor a list of UDP ports that are dedicated to RTP streams. See the API documentation:

http://rohc-lib.org/support/documentation/API/rohc-doc-1.6.1/group__rohc__comp.html#ga60547b56cea992e4967a99391fcd6489

http://rohc-lib.org/support/documentation/API/rohc-doc-1.6.1/group__rohc__comp.html#gae4007c48b1aaed847df86bf42f0b0e96

http://rohc-lib.org/support/documentation/API/rohc-doc-1.6.1/group__rohc__comp.html#ga4c2adababf10a9c65c9f8ec892217971

And an example:

http://bazaar.launchpad.net/~didier-barvaux/rohc/1.6.x/view/head:/test/functional/rtp_detection/test_rtp_ports.c

2/ callback function

Use the rohc_comp_set_rtp_detection_cb() function to give the ROHC compressor a function that it will call for every UDP packet. You have to write your own function. The function receives the IP headers, UDP header, and UDP payload as argument. The function returns true if packet is part if a RTP stream, false if it doesn't.

See http://rohc-lib.org/support/documentation/API/rohc-doc-1.6.1/group__rohc__comp.html#gae46d8370a4dbdb9153da8e89899b5596 for the API documentation.

See the example here http://bazaar.launchpad.net/~didier-barvaux/rohc/1.6.x/view/head:/test/functional/rtp_detection/test_rtp_callback.c

Regards,
Didier

Friedrich (hitlbs) said : #2

Hi Didier,

I would like to use the second method since I have too many UDP ports. In your example,

if(!rohc_comp_set_rtp_detection_cb(comp, callback_detect, NULL))
  {
   fprintf(stderr, "failed to set RTP detection callback\n");
   goto destroy_comp;
  }

  expected_profile = ROHC_PROFILE_RTP;

Suppose that I have a good callback_detect(). The program will execute "expected_profile = ROHC_PROFILE_RTP; "

My question is how I can use "expected_profile". I saw no use of it in your compressing example:
ret = rohc_compress2(comp, ip_packet, ip_size,
                      rohc_packet, MAX_ROHC_SIZE, &rohc_size);

How can the compressor know it is the RTP packet and compress it accordingly?

Thanks!

Hello,

The 'expected_profile' is defined for the purpose of the test only. It is not used by the ROHC library itself. I created an example for port-based detection and callback-based detection of RTP packets. It should help you understand how it works.

http://bazaar.launchpad.net/~didier-barvaux/rohc/main/view/head:/examples/rtp_detection.c

The example above will now be included in the library documentation.

Regards,
Didier

Can you help with this problem?

Provide an answer of your own, or ask Friedrich for more information if necessary.

To post a message you must log in.