From 99b331ead6cfdcae0543a28f511a440dbeb35e78 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Tue, 5 Dec 2017 12:52:27 +0100 Subject: [PATCH] Signal disposable sample in the h.264 importer. --- MP42/MP42H264Importer.mm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MP42/MP42H264Importer.mm b/MP42/MP42H264Importer.mm index ec54b23..8f1a48a 100644 --- a/MP42/MP42H264Importer.mm +++ b/MP42/MP42H264Importer.mm @@ -954,9 +954,8 @@ extern "C" uint32_t h264_get_frame_dependency (h264_decode_t *dec) else dflags |= MP4_SDT_HAS_NO_DEPENDENTS; /* disposable */ - if (dec->nal_unit_type != H264_NAL_TYPE_IDR_SLICE) { - if (H264_TYPE_IS_P(dec->slice_type)) dflags |= MP4_SDT_EARLIER_DISPLAY_TIMES_ALLOWED; - if (H264_TYPE_IS_I(dec->slice_type)) dflags |= MP4_SDT_EARLIER_DISPLAY_TIMES_ALLOWED;; + if (dec->nal_unit_type == H264_NAL_TYPE_IDR_SLICE) { + dflags |= MP4_SDT_IS_INDEPENDENT; } return dflags; @@ -1532,6 +1531,7 @@ NSData* H264Info(const char *filePath, uint32_t *pic_width, uint32_t *pic_height sample->size = nal_buffer_size; sample->duration = mp4FrameDuration; sample->flags = nal_is_sync ? MP42SampleBufferFlagIsSync : 0; + sample->dependecyFlags = dflags; sample->trackId = trackId; [self enqueue:sample]; @@ -1551,7 +1551,6 @@ NSData* H264Info(const char *filePath, uint32_t *pic_width, uint32_t *pic_height h264_dec.nal_unit_type, nal.buffer_on); } if (h264_nal_unit_type_is_slice(h264_dec.nal_unit_type)) { - dflags = h264_get_frame_dependency(&h264_dec); // copy all seis, etc before indicating first first = false; copy_nal_to_buffer = true; @@ -1559,6 +1558,7 @@ NSData* H264Info(const char *filePath, uint32_t *pic_width, uint32_t *pic_height poc = h264_dec.pic_order_cnt; nal_is_sync = h264_slice_is_idr(&h264_dec); + dflags = h264_get_frame_dependency(&h264_dec); } else { switch (h264_dec.nal_unit_type) { @@ -1618,6 +1618,7 @@ NSData* H264Info(const char *filePath, uint32_t *pic_width, uint32_t *pic_height sample->size = nal_buffer_size; sample->duration = mp4FrameDuration; sample->flags = nal_is_sync ? MP42SampleBufferFlagIsSync : 0; + sample->dependecyFlags = dflags; sample->trackId = trackId; [self enqueue:sample];