Bug 1045468 - WebRTC should support SVC NAL(NAL type 14) for H264. r=jesup, a=sledru
authorEthan Hugg <ethanhugg@gmail.com>
Thu, 31 Jul 2014 06:45:08 -0700
changeset 217493 aa7f00d2f78d3fe978f64bf4a4e89d215609c3e5
parent 217492 a75e270e297696e06b865f40798f45188d37fd42
child 217494 d92bf0799e5c9b1a6e80dfe769c029ce2727afca
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, sledru
bugs1045468
milestone33.0a2
Bug 1045468 - WebRTC should support SVC NAL(NAL type 14) for H264. r=jesup, a=sledru
media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc
media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_format_h264.h
media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_receiver_video.cc
--- a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc
+++ b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc
@@ -86,17 +86,17 @@ int RtpFormatH264::NextPacket(uint8_t* b
 #endif
     // single NAL_UNIT
     *bytes_to_send = payload_size_;
     // TODO(jesup) - this doesn't work correctly for Mode 0.
     // Unfortunately, we don't have a good signal to which NAL generated by
     // the encoder is the last NAL of the frame.  We need that to be passed
     // through to this point, instead of trying to generate it from the packets
     if (type == kH264NALU_SPS || type == kH264NALU_PPS ||
-        type == kH264NALU_SEI) {
+        type == kH264NALU_SEI||type == kh264NALU_PREFIX) {
       *last_packet   = false;
     } else {
       *last_packet   = true;
     }
     memcpy(buffer, payload_data_, payload_size_);
     WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1,
                  "RtpFormatH264(single NALU with type:%d, payload_size:%d",
                  type, payload_size_);
--- a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_format_h264.h
+++ b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_format_h264.h
@@ -35,16 +35,17 @@ namespace webrtc {
 class RtpFormatH264 {
  public:
   enum {
     kH264NALU_SLICE             = 1,
     kH264NALU_IDR               = 5,
     kH264NALU_SEI               = 6,
     kH264NALU_SPS               = 7,
     kH264NALU_PPS               = 8,
+    kh264NALU_PREFIX            = 14,
     kH264NALU_STAPA             = 24,
     kH264NALU_FUA               = 28
   };
 
   static const int kH264NALHeaderLengthInBytes = 1;
   static const int kH264FUAHeaderLengthInBytes = 2;
 
 // bits for FU (A and B) indicators
--- a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_receiver_video.cc
+++ b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_receiver_video.cc
@@ -295,16 +295,20 @@ int32_t RTPReceiverVideo::ReceiveH264Cod
           rtp_header->header.timestamp = timestamp - 20;
           rtp_header->frameType = kVideoFrameKey;
           break;
         case RtpFormatH264::kH264NALU_PPS:
           // TODO(jesup): Evil hack.  see below
           rtp_header->header.timestamp = timestamp - 10;
           rtp_header->frameType = kVideoFrameKey;
           break;
+        case RtpFormatH264::kh264NALU_PREFIX:
+          rtp_header->header.timestamp = timestamp - 5;
+          rtp_header->frameType = kVideoFrameKey;
+          break;
         case RtpFormatH264::kH264NALU_IDR:
           rtp_header->frameType = kVideoFrameKey;
           break;
         default:
           rtp_header->frameType = kVideoFrameDelta;
           break;
       }
       if (data_callback_->OnReceivedPayloadData(payload,
@@ -337,16 +341,19 @@ int32_t RTPReceiverVideo::ReceiveH264Cod
       // for SPS/PPS/IDR, not for PPS/SPS/IDR.  Keep this until all issues
       // are resolved in the jitter buffer
       case RtpFormatH264::kH264NALU_SPS:
         rtp_header->header.timestamp -= 10;
         // fall through
       case RtpFormatH264::kH264NALU_PPS:
         rtp_header->header.timestamp -= 10;
         // fall through
+      case RtpFormatH264::kh264NALU_PREFIX:
+        rtp_header->header.timestamp -= 5;
+        // fall through
       case RtpFormatH264::kH264NALU_IDR:
         rtp_header->frameType = kVideoFrameKey;
         break;
       default:
         rtp_header->frameType = kVideoFrameDelta;
         break;
     }
   }