[FFmpeg-cvslog] rtpdec_hevc: Skip 1 byte (DOND) instead of 2 (DONL) between aggregation units

Martin Storsjö git at videolan.org
Mon Feb 23 21:11:54 CET 2015


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sun Feb 22 23:25:28 2015 +0200| [fe208ca54b0d3b6bbe1c660d371bb2cc6cf40ffc] | committer: Martin Storsjö

rtpdec_hevc: Skip 1 byte (DOND) instead of 2 (DONL) between aggregation units

Only the first aggregation unit has 2 bytes (DONL) prepended, if
such a field is in use.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fe208ca54b0d3b6bbe1c660d371bb2cc6cf40ffc
---

 libavformat/rtpdec_h264.c |    9 +++------
 libavformat/rtpdec_hevc.c |    8 +++++++-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
index 9ee9f5e..ee1a993 100644
--- a/libavformat/rtpdec_h264.c
+++ b/libavformat/rtpdec_h264.c
@@ -181,7 +181,7 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
 
 int ff_h264_handle_aggregated_packet(AVFormatContext *ctx, AVPacket *pkt,
                                      const uint8_t *buf, int len,
-                                     int start_skip, int *nal_counters,
+                                     int skip_between, int *nal_counters,
                                      int nal_mask)
 {
     int pass         = 0;
@@ -194,9 +194,6 @@ int ff_h264_handle_aggregated_packet(AVFormatContext *ctx, AVPacket *pkt,
         const uint8_t *src = buf;
         int src_len        = len;
 
-        src     += start_skip;
-        src_len -= start_skip;
-
         while (src_len > 2) {
             uint16_t nal_size = AV_RB16(src);
 
@@ -224,8 +221,8 @@ int ff_h264_handle_aggregated_packet(AVFormatContext *ctx, AVPacket *pkt,
             }
 
             // eat what we handled
-            src     += nal_size + start_skip;
-            src_len -= nal_size + start_skip;
+            src     += nal_size + skip_between;
+            src_len -= nal_size + skip_between;
         }
 
         if (pass == 0) {
diff --git a/libavformat/rtpdec_hevc.c b/libavformat/rtpdec_hevc.c
index 98701a6..ac23462 100644
--- a/libavformat/rtpdec_hevc.c
+++ b/libavformat/rtpdec_hevc.c
@@ -317,9 +317,15 @@ static int hevc_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_hevc_ctx
         buf += RTP_HEVC_PAYLOAD_HEADER_SIZE;
         len -= RTP_HEVC_PAYLOAD_HEADER_SIZE;
 
+        /* pass the HEVC DONL field */
+        if (rtp_hevc_ctx->using_donl_field) {
+            buf += RTP_HEVC_DONL_FIELD_SIZE;
+            len -= RTP_HEVC_DONL_FIELD_SIZE;
+        }
+
         res = ff_h264_handle_aggregated_packet(ctx, pkt, buf, len,
                                                rtp_hevc_ctx->using_donl_field ?
-                                               RTP_HEVC_DONL_FIELD_SIZE : 0,
+                                               RTP_HEVC_DOND_FIELD_SIZE : 0,
                                                NULL, 0);
         if (res < 0)
             return res;



More information about the ffmpeg-cvslog mailing list