[Live-devel] Fwd: includeStartCodeInOutput parameter for H264VideoStreamDiscreteFramer::createNew()

Chris Paucar chris.paucar at roc-connect.com
Wed May 29 06:38:53 PDT 2019


I found a bug in the start code implementation. I noticed some artifacts in
the MPEG-TS video output and ffprobe analysis showed some errors with the I
and P frames suggesting the NAL units were corrupted. Through further
hexdump analysis I noticed the last 4 bytes of every NAL unit inside the TS
packets were missing. Just as a test I added the following line and the
ffprobe errors went away and the hexdump showed the 4 bytes restored. I
removed the line after testing.

diff --git a/src/liveMedia/H264or5VideoStreamDiscreteFramer.cpp
b/src/liveMedia/H264or5VideoStreamDiscreteFramer.cpp
index c2de4e8..d041c15 100644
--- a/src/liveMedia/H264or5VideoStreamDiscreteFramer.cpp
+++ b/src/liveMedia/H264or5VideoStreamDiscreteFramer.cpp
@@ -78,6 +78,7 @@ void H264or5VideoStreamDiscreteFramer
     nal_unit_type = 0xFF;
   }

+    frameSize += 4;
   // Begin by checking for a (likely) common error: NAL units that
(erroneously) begin with a
   // 0x00000001 or 0x000001 'start code'.  (Those start codes should only
be in byte-stream data;
   // *not* data that consists of discrete NAL units.)

I am using a subclass of H264VideoStreamDiscreteFramer to inject additional
NAL units into the TS stream, so I applied the fix there instead of
modifying the LIVE555 source code. Do you see any issues with this
approach? Even if you patch the LIVE555 source code I would still need to
adjust frameSize to account for the NAL units I am inserting into the
stream.

void ROCH264VideoStreamDiscreteFramer::afterGettingFrame1(unsigned
frameSize,
        unsigned numTruncatedBytes, struct timeval presentationTime,
        unsigned durationInMicroseconds)
{
    // ... code to add specific NAL units here ...

    frameSize += sizeof (start_code);
    frameSize += sizeof (specific_NAL_units);

    H264or5VideoStreamDiscreteFramer::afterGettingFrame1(frameSize,
            numTruncatedBytes, presentationTime, durationInMicroseconds);
}

Thanks,
Chris

On Tue, May 14, 2019 at 11:30 AM Ross Finlayson <finlayson at live555.com>
wrote:

>
>
> > On May 14, 2019, at 10:07 AM, Chris Paucar <chris.paucar at roc-connect.com>
> wrote:
> >
> > Have there been any recent changes to the TS part of the LIVE555?
>
> No.
>
>
> Ross Finlayson
> Live Networks, Inc.
> http://www.live555.com/
>
>
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20190529/309f1906/attachment.htm>


More information about the live-devel mailing list