diff options
author | Edward Hervey <bilboed@bilboed.com> | 2013-08-07 09:04:39 +0200 |
---|---|---|
committer | Edward Hervey <edward@collabora.com> | 2013-08-09 08:42:43 +0200 |
commit | 8074a48594acd17eaa2a2e7ea3fd03d85f41a664 (patch) | |
tree | 4f2d1b8df90c6e78bcb2e76935fdc9c5b3e88212 /gst | |
parent | b17676a1d5f1f9179eef32b92b22ecfbce902112 (diff) | |
download | gstreamer-plugins-bad-8074a48594acd17eaa2a2e7ea3fd03d85f41a664.tar.gz |
h264parse: Use slice type to determine if frame is keyframe
This is the same behaviour as pre-baseparse-refactoring
https://bugzilla.gnome.org/show_bug.cgi?id=705598
Diffstat (limited to 'gst')
-rw-r--r-- | gst/videoparsers/gsth264parse.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c index 0a2f69d4f..1a1e391d7 100644 --- a/gst/videoparsers/gsth264parse.c +++ b/gst/videoparsers/gsth264parse.c @@ -453,10 +453,6 @@ _nal_name (GstH264NalUnitType nal_type) } #endif -/* SPS/PPS/IDR considered key, all others DELTA; - * so downstream waiting for keyframe can pick up at SPS/PPS/IDR */ -#define NAL_TYPE_IS_KEY(nt) (((nt) == 5) || ((nt) == 7) || ((nt) == 8)) - /* caller guarantees 2 bytes of nal payload */ static void gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu) @@ -476,7 +472,6 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu) /* we have a peek as well */ nal_type = nalu->type; - h264parse->keyframe |= NAL_TYPE_IS_KEY (nal_type); GST_DEBUG_OBJECT (h264parse, "processing nal of type %u %s, size %u", nal_type, _nal_name (nal_type), nalu->size); @@ -572,18 +567,27 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu) h264parse->frame_start = TRUE; } GST_DEBUG_OBJECT (h264parse, "frame start: %i", h264parse->frame_start); -#ifndef GST_DISABLE_GST_DEBUG { GstH264SliceHdr slice; - GstH264ParserResult pres; pres = gst_h264_parser_parse_slice_hdr (nalparser, nalu, &slice, FALSE, FALSE); GST_DEBUG_OBJECT (h264parse, "parse result %d, first MB: %u, slice type: %u", pres, slice.first_mb_in_slice, slice.type); + if (pres == GST_H264_PARSER_OK) { + switch (slice.type) { + case 2: + case 4: + case 7: + case 9: + h264parse->keyframe |= TRUE; + + default: + break; + } + } } -#endif if (G_LIKELY (nal_type != GST_H264_NAL_SLICE_IDR && !h264parse->push_codec)) break; |