rtph263pay: use found GOBs to apply Mode A payloading

... rather than falling back to sending the whole frame in one packet
if number of GOB startcodes < maximum.
One might take this further and still perform Mode B/C payloading,
but at least this should cater for decent fragments in typical cases.

Fixes #599585.
This commit is contained in:
Mark Nauwelaerts 2010-04-16 11:53:17 +02:00
parent a6bb8338fd
commit a08f76a92e
2 changed files with 20 additions and 8 deletions

View file

@ -1302,7 +1302,7 @@ gst_rtp_h263_pay_A_fragment_push (GstRtpH263Pay * rtph263pay,
(context->gobs[last]->end - context->gobs[first]->start) + 1;
pack->marker = FALSE;
if (last == format_props[context->piclayer->ptype_srcformat][0] - 1) {
if (last == context->no_gobs - 1) {
pack->marker = TRUE;
}
@ -1645,6 +1645,7 @@ gst_rtp_h263_pay_flush (GstRtpH263Pay * rtph263pay)
GstRtpH263PayBoundry bound;
gint first;
guint payload_len;
gboolean forcea = FALSE;
GST_DEBUG ("Frame too large for MTU");
/*
@ -1660,10 +1661,16 @@ gst_rtp_h263_pay_flush (GstRtpH263Pay * rtph263pay)
for (i = 0; i < format_props[context->piclayer->ptype_srcformat][0]; i++) {
GST_DEBUG ("Searching for gob %d", i);
if (!gst_rtp_h263_pay_gobfinder (rtph263pay, &bound)) {
GST_WARNING
("No GOB's were found in data stream! Please enable RTP mode in encoder. Forcing mode A for now.");
ret = gst_rtp_h263_send_entire_frame (rtph263pay, context);
goto end;
if (i <= 1) {
GST_WARNING
("No GOB's were found in data stream! Please enable RTP mode in encoder. Forcing mode A for now.");
ret = gst_rtp_h263_send_entire_frame (rtph263pay, context);
goto end;
} else {
/* try to send fragments corresponding to found GOBs */
forcea = TRUE;
break;
}
}
context->gobs[i] = gst_rtp_h263_pay_gob_new (&bound, i);
@ -1673,6 +1680,10 @@ gst_rtp_h263_pay_flush (GstRtpH263Pay * rtph263pay)
context->gobs[i]->start, context->gobs[i]->length,
context->gobs[i]->ebit, context->gobs[i]->sbit);
}
/* NOTE some places may still assume this to be the max possible */
context->no_gobs = i;
GST_DEBUG ("Found %d GOBS of maximum %d",
context->no_gobs, format_props[context->piclayer->ptype_srcformat][0]);
// Make packages smaller than MTU
// A mode
@ -1682,13 +1693,13 @@ gst_rtp_h263_pay_flush (GstRtpH263Pay * rtph263pay)
first = 0;
payload_len = 0;
i = 0;
while (i < format_props[context->piclayer->ptype_srcformat][0]) {
while (i < context->no_gobs) {
if (context->gobs[i]->length >= context->mtu) {
if (payload_len == 0) {
GST_DEBUG ("GOB len > MTU");
if (rtph263pay->prop_payload_mode) {
if (rtph263pay->prop_payload_mode || forcea) {
payload_len = context->gobs[i]->length;
goto force_a;
}
@ -1723,7 +1734,7 @@ gst_rtp_h263_pay_flush (GstRtpH263Pay * rtph263pay)
GST_DEBUG ("GOB %d fills mtu", i);
payload_len += context->gobs[i]->length;
i++;
if (i == format_props[context->piclayer->ptype_srcformat][0]) {
if (i == context->no_gobs) {
GST_DEBUG ("LAST GOB %d", i);
goto payload_a_push;
}

View file

@ -80,6 +80,7 @@ struct _GstRtpH263PayContext
guint8 *win_end;
guint8 cpm;
guint no_gobs;
GstRtpH263PayGob **gobs;
};