mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
h264parse: bring debug statements up to desired specs
This commit is contained in:
parent
e6212219ed
commit
66f644cfcc
1 changed files with 23 additions and 20 deletions
|
@ -339,7 +339,8 @@ gst_h264_parse_wrap_nal (GstH264Parse * h264parse, guint format, guint8 * data,
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
const guint nl = h264parse->nal_length_size;
|
const guint nl = h264parse->nal_length_size;
|
||||||
|
|
||||||
GST_DEBUG ("Nal length %d %d", size, h264parse->nal_length_size);
|
GST_DEBUG_OBJECT (h264parse, "nal length %d %d", size,
|
||||||
|
h264parse->nal_length_size);
|
||||||
|
|
||||||
buf = gst_buffer_new_and_alloc (size + nl + 4);
|
buf = gst_buffer_new_and_alloc (size + nl + 4);
|
||||||
if (format == GST_H264_PARSE_FORMAT_AVC) {
|
if (format == GST_H264_PARSE_FORMAT_AVC) {
|
||||||
|
@ -365,11 +366,11 @@ gst_h264_parser_store_nal (GstH264Parse * h264parse, guint id,
|
||||||
if (naltype == GST_H264_NAL_SPS) {
|
if (naltype == GST_H264_NAL_SPS) {
|
||||||
store_size = GST_H264_MAX_SPS_COUNT;
|
store_size = GST_H264_MAX_SPS_COUNT;
|
||||||
store = h264parse->sps_nals;
|
store = h264parse->sps_nals;
|
||||||
GST_DEBUG ("Storing sps %u", id);
|
GST_DEBUG_OBJECT (h264parse, "storing sps %u", id);
|
||||||
} else if (naltype == GST_H264_NAL_PPS) {
|
} else if (naltype == GST_H264_NAL_PPS) {
|
||||||
store_size = GST_H264_MAX_PPS_COUNT;
|
store_size = GST_H264_MAX_PPS_COUNT;
|
||||||
store = h264parse->pps_nals;
|
store = h264parse->pps_nals;
|
||||||
GST_DEBUG ("Storing pps %u", id);
|
GST_DEBUG_OBJECT (h264parse, "storing pps %u", id);
|
||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -477,8 +478,8 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
|
||||||
/* if we need to sneak codec NALs into the stream,
|
/* if we need to sneak codec NALs into the stream,
|
||||||
* this is a good place, so fake it as IDR
|
* this is a good place, so fake it as IDR
|
||||||
* (which should be at start anyway) */
|
* (which should be at start anyway) */
|
||||||
GST_DEBUG ("Frame start: %i first_mb_in_slice %i", h264parse->frame_start,
|
GST_DEBUG_OBJECT (h264parse, "frame start: %i first_mb_in_slice %i",
|
||||||
slice.first_mb_in_slice);
|
h264parse->frame_start, slice.first_mb_in_slice);
|
||||||
if (G_LIKELY (!h264parse->push_codec))
|
if (G_LIKELY (!h264parse->push_codec))
|
||||||
break;
|
break;
|
||||||
/* fall-through */
|
/* fall-through */
|
||||||
|
@ -487,7 +488,7 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
|
||||||
if (gst_h264_parser_parse_slice_hdr (nalparser, nalu,
|
if (gst_h264_parser_parse_slice_hdr (nalparser, nalu,
|
||||||
&slice, FALSE, FALSE) == GST_H264_PARSER_ERROR)
|
&slice, FALSE, FALSE) == GST_H264_PARSER_ERROR)
|
||||||
return;
|
return;
|
||||||
GST_DEBUG ("Frame start: %i first_mb_in_slice %i",
|
GST_DEBUG_OBJECT (h264parse, "frame start: %i first_mb_in_slice %i",
|
||||||
h264parse->frame_start, slice.first_mb_in_slice);
|
h264parse->frame_start, slice.first_mb_in_slice);
|
||||||
}
|
}
|
||||||
/* real frame data */
|
/* real frame data */
|
||||||
|
@ -504,8 +505,8 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
|
||||||
h264parse->idr_pos);
|
h264parse->idr_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG ("first MB: %u, slice type: %u", slice.first_mb_in_slice,
|
GST_DEBUG_OBJECT (h264parse, "first MB: %u, slice type: %u",
|
||||||
slice.type);
|
slice.first_mb_in_slice, slice.type);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
gst_h264_parser_parse_nal (nalparser, nalu);
|
gst_h264_parser_parse_nal (nalparser, nalu);
|
||||||
|
@ -534,7 +535,7 @@ gst_h264_parse_collect_nal (GstH264Parse * h264parse, const guint8 * data,
|
||||||
GstH264NalUnitType nal_type = nalu->type;
|
GstH264NalUnitType nal_type = nalu->type;
|
||||||
GstH264NalUnit nnalu;
|
GstH264NalUnit nnalu;
|
||||||
|
|
||||||
GST_DEBUG ("Parsing collecte nal");
|
GST_DEBUG_OBJECT (h264parse, "parsing collected nal");
|
||||||
parse_res = gst_h264_parser_identify_nalu (h264parse->nalparser, data,
|
parse_res = gst_h264_parser_identify_nalu (h264parse->nalparser, data,
|
||||||
nalu->offset + nalu->size, size, &nnalu);
|
nalu->offset + nalu->size, size, &nnalu);
|
||||||
|
|
||||||
|
@ -615,16 +616,18 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse,
|
||||||
drain = GST_BASE_PARSE_DRAINING (parse);
|
drain = GST_BASE_PARSE_DRAINING (parse);
|
||||||
current_off = h264parse->current_off;
|
current_off = h264parse->current_off;
|
||||||
|
|
||||||
GST_DEBUG ("Last parse position %u", current_off);
|
GST_DEBUG_OBJECT (h264parse, "last parse position %u", current_off);
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
switch (gst_h264_parser_identify_nalu (nalparser, data, current_off,
|
switch (gst_h264_parser_identify_nalu (nalparser, data, current_off,
|
||||||
size, &nalu)) {
|
size, &nalu)) {
|
||||||
case GST_H264_PARSER_OK:
|
case GST_H264_PARSER_OK:
|
||||||
GST_DEBUG ("Complete nal found. %u Off: %u, Size: %u",
|
GST_DEBUG_OBJECT (h264parse, "complete nal found. "
|
||||||
|
"current offset: %u, Nal offset: %u, Nal Size: %u",
|
||||||
current_off, nalu.offset, nalu.size);
|
current_off, nalu.offset, nalu.size);
|
||||||
|
|
||||||
current_off = nalu.offset + nalu.size;
|
current_off = nalu.offset + nalu.size;
|
||||||
GST_DEBUG ("CURENT OFF. %u, %u", current_off, nalu.offset + nalu.size);
|
GST_DEBUG_OBJECT (h264parse, "current off. %u, %u", current_off,
|
||||||
|
nalu.offset + nalu.size);
|
||||||
if (!h264parse->nalu.size && !h264parse->nalu.valid)
|
if (!h264parse->nalu.size && !h264parse->nalu.valid)
|
||||||
h264parse->nalu = nalu;
|
h264parse->nalu = nalu;
|
||||||
break;
|
break;
|
||||||
|
@ -646,15 +649,15 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse,
|
||||||
if (nalu.sc_offset == h264parse->nalu.sc_offset) {
|
if (nalu.sc_offset == h264parse->nalu.sc_offset) {
|
||||||
*skipsize = nalu.offset;
|
*skipsize = nalu.offset;
|
||||||
|
|
||||||
GST_DEBUG ("Skiping broken nal");
|
GST_DEBUG_OBJECT (h264parse, "skipping broken nal");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
nalu.size = 0;
|
nalu.size = 0;
|
||||||
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
case GST_H264_PARSER_NO_NAL_END:
|
case GST_H264_PARSER_NO_NAL_END:
|
||||||
GST_DEBUG ("Not a complete nal found at offset %u", nalu.offset);
|
GST_DEBUG_OBJECT (h264parse, "not a complete nal found at offset %u",
|
||||||
|
nalu.offset);
|
||||||
|
|
||||||
current_off = nalu.sc_offset;
|
current_off = nalu.sc_offset;
|
||||||
/* We keep the reference to this nal so we start over the parsing
|
/* We keep the reference to this nal so we start over the parsing
|
||||||
|
@ -663,8 +666,8 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse,
|
||||||
h264parse->nalu = nalu;
|
h264parse->nalu = nalu;
|
||||||
|
|
||||||
if (drain) {
|
if (drain) {
|
||||||
GST_DEBUG ("Drainning NAL %u %u %u", size, h264parse->nalu.offset,
|
GST_DEBUG_OBJECT (h264parse, "drainning NAL %u %u %u", size,
|
||||||
h264parse->nalu.size);
|
h264parse->nalu.offset, h264parse->nalu.size);
|
||||||
/* Can't parse the nalu */
|
/* Can't parse the nalu */
|
||||||
if (size - h264parse->nalu.offset < 2) {
|
if (size - h264parse->nalu.offset < 2) {
|
||||||
*skipsize = nalu.offset;
|
*skipsize = nalu.offset;
|
||||||
|
@ -680,8 +683,8 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse,
|
||||||
|
|
||||||
current_off = nalu.offset + nalu.size;
|
current_off = nalu.offset + nalu.size;
|
||||||
|
|
||||||
GST_DEBUG ("%p Complete nal found. Off: %u, Size: %u", data, nalu.offset,
|
GST_DEBUG_OBJECT (h264parse, "%p complete nal found. Off: %u, Size: %u",
|
||||||
nalu.size);
|
data, nalu.offset, nalu.size);
|
||||||
|
|
||||||
gst_h264_parse_process_nal (h264parse, &nalu);
|
gst_h264_parse_process_nal (h264parse, &nalu);
|
||||||
if (gst_h264_parse_collect_nal (h264parse, data, size, &nalu) || drain)
|
if (gst_h264_parse_collect_nal (h264parse, data, size, &nalu) || drain)
|
||||||
|
@ -700,7 +703,7 @@ end:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
parsing_error:
|
parsing_error:
|
||||||
GST_DEBUG ("Error parsing Nal Unit");
|
GST_DEBUG_OBJECT (h264parse, "error parsing Nal Unit");
|
||||||
more:
|
more:
|
||||||
|
|
||||||
/* ask for best next available */
|
/* ask for best next available */
|
||||||
|
|
Loading…
Reference in a new issue