Bug 985254: Add H264 codec-specific structure to carry negotiated data r=pkerr
authorRandell Jesup <rjesup@jesup.org>
Sat, 24 May 2014 18:28:01 -0400
changeset 204070 53c1c87969b5046e28f28e0eb4ed94164096c8fc
parent 204069 d00df59cb452bc8761196ac61a51ac68c4fc1456
child 204071 11b8d066523245d35925f5c5ef6e33514ac3ddf2
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspkerr
bugs985254
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 985254: Add H264 codec-specific structure to carry negotiated data r=pkerr
media/webrtc/trunk/webrtc/common_types.h
media/webrtc/trunk/webrtc/modules/video_coding/main/source/generic_encoder.cc
media/webrtc/trunk/webrtc/video_engine/vie_codec_impl.cc
--- a/media/webrtc/trunk/webrtc/common_types.h
+++ b/media/webrtc/trunk/webrtc/common_types.h
@@ -6,16 +6,17 @@
  *  tree. An additional intellectual property rights grant can be found
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
 #ifndef WEBRTC_COMMON_TYPES_H_
 #define WEBRTC_COMMON_TYPES_H_
 
+#include <stddef.h> // size_t
 #include "webrtc/typedefs.h"
 
 #if defined(_MSC_VER)
 // Disable "new behavior: elements of array will be default initialized"
 // warning. Affects OverUseDetectorOptions.
 #pragma warning(disable:4351)
 #endif
 
@@ -500,16 +501,32 @@ struct VideoCodecVP8
     unsigned char        numberOfTemporalLayers;
     bool                 denoisingOn;
     bool                 errorConcealmentOn;
     bool                 automaticResizeOn;
     bool                 frameDroppingOn;
     int                  keyFrameInterval;
 };
 
+// H264 specific
+struct VideoCodecH264
+{
+    uint8_t        profile;
+    uint8_t        constraints;
+    uint8_t        level;
+    uint8_t        packetizationMode; // 0 or 1
+    bool           frameDroppingOn;
+    int            keyFrameInterval;
+    // These are null/0 if not externally negotiated
+    const uint8_t* spsData;
+    size_t         spsLen;
+    const uint8_t* ppsData;
+    size_t         ppsLen;
+};
+
 // Unknown specific
 struct VideoCodecGeneric
 {
 };
 
 // Video codec types
 enum VideoCodecType {
     kVideoCodecVP8,
@@ -519,16 +536,17 @@ enum VideoCodecType {
     kVideoCodecULPFEC,
     kVideoCodecGeneric,
     kVideoCodecUnknown
 };
 
 union VideoCodecUnion
 {
     VideoCodecVP8       VP8;
+    VideoCodecH264      H264;
     VideoCodecGeneric   Generic;
 };
 
 
 // Simulcast is when the same stream is encoded multiple times with different
 // settings such as resolution.
 struct SimulcastStream
 {
--- a/media/webrtc/trunk/webrtc/modules/video_coding/main/source/generic_encoder.cc
+++ b/media/webrtc/trunk/webrtc/modules/video_coding/main/source/generic_encoder.cc
@@ -256,16 +256,20 @@ void VCMEncodedFrameCallback::CopyCodecS
           info.codecSpecific.VP8.nonReference;
       (*rtp)->codecHeader.VP8.temporalIdx = info.codecSpecific.VP8.temporalIdx;
       (*rtp)->codecHeader.VP8.layerSync = info.codecSpecific.VP8.layerSync;
       (*rtp)->codecHeader.VP8.tl0PicIdx = info.codecSpecific.VP8.tl0PicIdx;
       (*rtp)->codecHeader.VP8.keyIdx = info.codecSpecific.VP8.keyIdx;
       (*rtp)->simulcastIdx = info.codecSpecific.VP8.simulcastIdx;
       return;
     }
+    case kVideoCodecH264:
+      (*rtp)->codec = kRtpVideoH264;
+      (*rtp)->simulcastIdx = info.codecSpecific.H264.simulcastIdx;
+      return;
     case kVideoCodecGeneric:
       (*rtp)->codec = kRtpVideoGeneric;
       (*rtp)->simulcastIdx = info.codecSpecific.generic.simulcast_idx;
       return;
     default:
       // No codec specific info. Change RTP header pointer to NULL.
       *rtp = NULL;
       return;
--- a/media/webrtc/trunk/webrtc/video_engine/vie_codec_impl.cc
+++ b/media/webrtc/trunk/webrtc/video_engine/vie_codec_impl.cc
@@ -127,16 +127,32 @@ int ViECodecImpl::SetSendCodec(const int
                  "keyFrameInterval %d",
                  video_codec.codecSpecific.VP8.pictureLossIndicationOn,
                  video_codec.codecSpecific.VP8.feedbackModeOn,
                  video_codec.codecSpecific.VP8.complexity,
                  video_codec.codecSpecific.VP8.resilience,
                  video_codec.codecSpecific.VP8.numberOfTemporalLayers,
                  video_codec.codecSpecific.VP8.keyFrameInterval);
   }
+  if (video_codec.codecType == kVideoCodecH264) {
+    WEBRTC_TRACE(kTraceInfo, kTraceVideo,
+                 ViEId(shared_data_->instance_id(), video_channel),
+                 "profile: 0x%02x, constraints: 0x%02x, level 0x%02x (%1.1f), "
+                 "packetizationMode: %u, frameDropping %d, "
+                 "keyFrameInterval %d, SPS len %d, PPS len %d",
+                 video_codec.codecSpecific.H264.profile,
+                 video_codec.codecSpecific.H264.constraints,
+                 video_codec.codecSpecific.H264.level,
+                 video_codec.codecSpecific.H264.level/10.0,
+                 video_codec.codecSpecific.H264.packetizationMode,
+                 video_codec.codecSpecific.H264.frameDroppingOn,
+                 video_codec.codecSpecific.H264.keyFrameInterval,
+                 video_codec.codecSpecific.H264.spsLen,
+                 video_codec.codecSpecific.H264.ppsLen);
+  }
   if (!CodecValid(video_codec)) {
     // Error logged.
     shared_data_->SetLastError(kViECodecInvalidCodec);
     return -1;
   }
 
   ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
   ViEChannel* vie_channel = cs.Channel(video_channel);