mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
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:
parent
a6bb8338fd
commit
a08f76a92e
2 changed files with 20 additions and 8 deletions
|
@ -1302,7 +1302,7 @@ gst_rtp_h263_pay_A_fragment_push (GstRtpH263Pay * rtph263pay,
|
||||||
(context->gobs[last]->end - context->gobs[first]->start) + 1;
|
(context->gobs[last]->end - context->gobs[first]->start) + 1;
|
||||||
pack->marker = FALSE;
|
pack->marker = FALSE;
|
||||||
|
|
||||||
if (last == format_props[context->piclayer->ptype_srcformat][0] - 1) {
|
if (last == context->no_gobs - 1) {
|
||||||
pack->marker = TRUE;
|
pack->marker = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1645,6 +1645,7 @@ gst_rtp_h263_pay_flush (GstRtpH263Pay * rtph263pay)
|
||||||
GstRtpH263PayBoundry bound;
|
GstRtpH263PayBoundry bound;
|
||||||
gint first;
|
gint first;
|
||||||
guint payload_len;
|
guint payload_len;
|
||||||
|
gboolean forcea = FALSE;
|
||||||
|
|
||||||
GST_DEBUG ("Frame too large for MTU");
|
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++) {
|
for (i = 0; i < format_props[context->piclayer->ptype_srcformat][0]; i++) {
|
||||||
GST_DEBUG ("Searching for gob %d", i);
|
GST_DEBUG ("Searching for gob %d", i);
|
||||||
if (!gst_rtp_h263_pay_gobfinder (rtph263pay, &bound)) {
|
if (!gst_rtp_h263_pay_gobfinder (rtph263pay, &bound)) {
|
||||||
GST_WARNING
|
if (i <= 1) {
|
||||||
("No GOB's were found in data stream! Please enable RTP mode in encoder. Forcing mode A for now.");
|
GST_WARNING
|
||||||
ret = gst_rtp_h263_send_entire_frame (rtph263pay, context);
|
("No GOB's were found in data stream! Please enable RTP mode in encoder. Forcing mode A for now.");
|
||||||
goto end;
|
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);
|
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]->start, context->gobs[i]->length,
|
||||||
context->gobs[i]->ebit, context->gobs[i]->sbit);
|
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
|
// Make packages smaller than MTU
|
||||||
// A mode
|
// A mode
|
||||||
|
@ -1682,13 +1693,13 @@ gst_rtp_h263_pay_flush (GstRtpH263Pay * rtph263pay)
|
||||||
first = 0;
|
first = 0;
|
||||||
payload_len = 0;
|
payload_len = 0;
|
||||||
i = 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 (context->gobs[i]->length >= context->mtu) {
|
||||||
if (payload_len == 0) {
|
if (payload_len == 0) {
|
||||||
|
|
||||||
GST_DEBUG ("GOB len > MTU");
|
GST_DEBUG ("GOB len > MTU");
|
||||||
if (rtph263pay->prop_payload_mode) {
|
if (rtph263pay->prop_payload_mode || forcea) {
|
||||||
payload_len = context->gobs[i]->length;
|
payload_len = context->gobs[i]->length;
|
||||||
goto force_a;
|
goto force_a;
|
||||||
}
|
}
|
||||||
|
@ -1723,7 +1734,7 @@ gst_rtp_h263_pay_flush (GstRtpH263Pay * rtph263pay)
|
||||||
GST_DEBUG ("GOB %d fills mtu", i);
|
GST_DEBUG ("GOB %d fills mtu", i);
|
||||||
payload_len += context->gobs[i]->length;
|
payload_len += context->gobs[i]->length;
|
||||||
i++;
|
i++;
|
||||||
if (i == format_props[context->piclayer->ptype_srcformat][0]) {
|
if (i == context->no_gobs) {
|
||||||
GST_DEBUG ("LAST GOB %d", i);
|
GST_DEBUG ("LAST GOB %d", i);
|
||||||
goto payload_a_push;
|
goto payload_a_push;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ struct _GstRtpH263PayContext
|
||||||
guint8 *win_end;
|
guint8 *win_end;
|
||||||
guint8 cpm;
|
guint8 cpm;
|
||||||
|
|
||||||
|
guint no_gobs;
|
||||||
GstRtpH263PayGob **gobs;
|
GstRtpH263PayGob **gobs;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue