# Adjusting RTP packetization parameters

Adjust the RTP packetization parameters for data transmitted from the PSTN side to the IP side of the 3G-324M Interface. You can do this by setting parameters to control the maximum size and the aggregation threshold of the payload in the RTP packets created by the video RTP endpoint. You can also set a parameter that controls whether packet aggregation takes place - except on H.264 endpoints where there is no aggregation.

The size and aggregation parameters are used to fine tune CG board performance against system delay, network traffic, and so forth. An example is with video tromboning where the system delay is doubled because of the application architecture. In this case, the goal is to reduce the RTP packet size, while maintaining minimum density requirements. The default parameter values are recommended for most applications.

You can optionally query existing parameter settings, before or after you reset parameter values. If you perform the query as part of a read-modify-write sequence, call the query after you disable the endpoint that you want to modify.

Note: This feature is for all video full-duplex and simplex send RTP endpoints only. The procedure and example are shown for full-duplex endpoints.

The following table shows how to query and change RTP packet size and aggregation values:

Step | Action
1 | Create the MSP_QRY_RTPFDX_VIDEO_RTP_PKTSZ_CTRL query, and send it to the CG board. The MSP_QRY_RTPFDX_VIDEO_RTP_PKTSZ_CTRL query uses the msp_ENDPOINT_RTPFDX_RTP_PKTSZ_CTRL structure to display parameters for the specified RTP endpoint. For more information, see Creating and sending MSPP queries and msp_ENDPOINT_RTPFDX_RTP_PKTSZ_CTRL.
2 | Disable the RTP endpoint by invoking mspDisableEndpoint.
3 | Create the MSP_CMD_RTPFDX_VIDEO_RTP_PKTSZ_CTRL command, and send it to the CG board. The MSP_CMD_RTPFDX_VIDEO_RTP_PKTSZ_CTRL command uses the msp_ENDPOINT_RTPFDX_RTP_PKTSZ_CTRL structure to change parameter values for the specified RTP endpoint.
4 | Enable the RTP endpoint by invoking mspEnableEndpoint.

The following events can be returned:

Event | Description
MSPEVN_QUERY_DONE | Indicates that the MSP_QRY_RTPFDX_VIDEO_RTP_PKTSZ_CTRL query was successfully sent to the specified RTP endpoint on the CG board.
MSPEVN_SENDCOMMAND_DONE | Indicates that the MSP_CMD_RTPFDX_VIDEO_RTP_PKTSZ_CTRL command was successfully sent to the specified RTP endpoint on the CG board.

#### Examples

The following example shows how to query the values of the packet size and aggregation parameters for the packets transmitted by the specified RTP endpoint with the MSP handle ephd:

msp_ENDPOINT_RTPFDX_RTP_PKTSZ_CTRL pktSzCtrl;
DWORD query
query = mspBuildQuery(MSP_ENDPOINT_RTPFDX_VIDEO_H263,
MSP_QRY_RTPFDX_VIDEO_RTP_PKTSZ_CTRL);
if (mspSendQuery(ephd, query) != SUCCESS)
printf("\n\t ERROR: mspSendQuery failed.\n");
expectedEvent = (MSPEVN_QUERY_DONE | MSP_QRY_RTPFDX_VIDEO_RTP_PKTSZ_CTRL);
if (WaitForSpecificEvent(gw, ctaQueueHd, expectedEvent, &event) != 0)
printf("\n\tERROR: mspSendQuery failed to send valid completion event\n");
pktSzCtrl = *(msp_ENDPOINT_RTPFDX_RTP_PKTSZ_CTRL *)(((char *)event.buffer)+sizeof(DWORD));
pktSzCtrl.pktMaxSz = NMS2H_DWORD(pktSzCtrl.pktMaxSz);
pktSzCtrl.aggThreshold = NMS2H_DWORD(pktSzCtrl.aggThreshold);
pktSzCtrl.enableAggregation = NMS2H_DWORD(pktSzCtrl.enableAggregation);
printf("\n\tQuery RTP Maximum Packet Size Control values:\n");
printf("\t\tRTP maximum packet size: %d bytes\n", pktSzCtrl.pktMaxSz);
printf("\t\tRTP aggregation flag = %d\n", pktSzCtrl.enableAggregation);
if (pktSzCtrl.enableAggregation)
printf("\t\tRTP aggregation threshold: %d bytes\n", pktSzCtrl.aggThreshold);
// Query returns a CTA buffer; release it.
mspReleaseBuffer(ctaQueueHd, event.buffer);

The following example shows how to adjust the maximum size and the threshold for an RTP endpoint with the MSP handle ephd:

CTA_EVENT event;
msp_ENDPOINT_RTPFDX_RTP_PKTSZ_CTRL pktSzCtrl;
pktSzCtrl.pktMaxSz = 1400; // Random example: max – 40 bytes
pktSzCtrl.aggThreshold = 600; // Random example: default – 100 bytes
pktSzCtrl.enableAggregation = 1; // ENABLE aggregation of GOB frames
ret = mspDisableEndpoint(ephd);
ret = WaitForSpecificEvent(gw, ctaQueueHd, MSPEVN_DISABLE_ENDPOINT_DONE, &event );
ret = mspSendCommand(ephd, mspBuildCommand(MSP_ENDPOINT_RTPFDX_VIDEO_H263,
MSP_CMD_RTPFDX_VIDEO_RTP_PKTSZ_CTRL), &pktSzCtrl,
sizeof(pktSzCtrl) );
ret = WaitForSpecificEvent(gw, ctaQueueHd,
MSPEVN_SENDCOMMAND_DONE | MSP_CMD_RTPFDX_VIDEO_RTP_PKTSZ_CTRL,
&event );
ret = mspEnableEndpoint(ephd);
ret = WaitForSpecificEvent(gw, ctaQueueHd, MSPEVN_ENABLE_ENDPOINT_DONE, &event );