Add boilerplate code for H.264.
R=mflodman@webrtc.org, niklas.enbom@webrtc.org Review URL: https://webrtc-codereview.appspot.com/17849005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6603 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -75,14 +75,22 @@ struct RTPVideoHeaderVP8 {
|
||||
bool beginningOfPartition; // True if this packet is the first
|
||||
// in a VP8 partition. Otherwise false
|
||||
};
|
||||
|
||||
struct RTPVideoHeaderH264 {
|
||||
uint8_t nalu_header;
|
||||
bool single_nalu;
|
||||
};
|
||||
|
||||
union RTPVideoTypeHeader {
|
||||
RTPVideoHeaderVP8 VP8;
|
||||
RTPVideoHeaderH264 H264;
|
||||
};
|
||||
|
||||
enum RtpVideoCodecTypes {
|
||||
kRtpVideoNone,
|
||||
kRtpVideoGeneric,
|
||||
kRtpVideoVp8
|
||||
kRtpVideoVp8,
|
||||
kRtpVideoH264
|
||||
};
|
||||
struct RTPVideoHeader {
|
||||
uint16_t width; // size
|
||||
|
||||
@@ -434,6 +434,8 @@ class RTPPayloadVideoStrategy : public RTPPayloadStrategy {
|
||||
RtpVideoCodecTypes videoType = kRtpVideoGeneric;
|
||||
if (ModuleRTPUtility::StringCompare(payloadName, "VP8", 3)) {
|
||||
videoType = kRtpVideoVp8;
|
||||
} else if (ModuleRTPUtility::StringCompare(payloadName, "H264", 4)) {
|
||||
videoType = kRtpVideoH264;
|
||||
} else if (ModuleRTPUtility::StringCompare(payloadName, "I420", 4)) {
|
||||
videoType = kRtpVideoGeneric;
|
||||
} else if (ModuleRTPUtility::StringCompare(payloadName, "ULPFEC", 6)) {
|
||||
|
||||
@@ -113,6 +113,8 @@ int32_t RTPReceiverVideo::ParseVideoCodecSpecific(
|
||||
return ReceiveGenericCodec(rtp_header, payload_data, payload_data_length);
|
||||
case kRtpVideoVp8:
|
||||
return ReceiveVp8Codec(rtp_header, payload_data, payload_data_length);
|
||||
case kRtpVideoH264:
|
||||
assert(false); // Not yet supported.
|
||||
case kRtpVideoNone:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -90,6 +90,8 @@ int32_t RTPSenderVideo::RegisterVideoPayload(
|
||||
RtpVideoCodecTypes videoType = kRtpVideoGeneric;
|
||||
if (ModuleRTPUtility::StringCompare(payloadName, "VP8",3)) {
|
||||
videoType = kRtpVideoVp8;
|
||||
} else if (ModuleRTPUtility::StringCompare(payloadName, "H264", 4)) {
|
||||
videoType = kRtpVideoH264;
|
||||
} else if (ModuleRTPUtility::StringCompare(payloadName, "I420", 4)) {
|
||||
videoType = kRtpVideoGeneric;
|
||||
} else {
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace webrtc {
|
||||
#define VCM_ULPFEC_PAYLOAD_TYPE 97
|
||||
#define VCM_VP8_PAYLOAD_TYPE 100
|
||||
#define VCM_I420_PAYLOAD_TYPE 124
|
||||
#define VCM_H264_PAYLOAD_TYPE 127
|
||||
|
||||
enum VCMVideoProtection {
|
||||
kProtectionNack, // Both send-side and receive-side
|
||||
|
||||
@@ -102,6 +102,30 @@ bool VCMCodecDataBase::Codec(int list_id,
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#ifdef VIDEOCODEC_H264
|
||||
case VCM_H264_IDX: {
|
||||
strncpy(settings->plName, "H264", 5);
|
||||
settings->codecType = kVideoCodecH264;
|
||||
// 96 to 127 dynamic payload types for video codecs.
|
||||
settings->plType = VCM_H264_PAYLOAD_TYPE;
|
||||
settings->startBitrate = 100;
|
||||
settings->minBitrate = VCM_MIN_BITRATE;
|
||||
settings->maxBitrate = 0;
|
||||
settings->maxFramerate = VCM_DEFAULT_FRAME_RATE;
|
||||
settings->width = VCM_DEFAULT_CODEC_WIDTH;
|
||||
settings->height = VCM_DEFAULT_CODEC_HEIGHT;
|
||||
settings->numberOfSimulcastStreams = 0;
|
||||
settings->qpMax = 56;
|
||||
settings->codecSpecific.H264.profile = kProfileBase;
|
||||
settings->codecSpecific.H264.frameDroppingOn = true;
|
||||
settings->codecSpecific.H264.keyFrameInterval = 3000;
|
||||
settings->codecSpecific.H264.spsData = NULL;
|
||||
settings->codecSpecific.H264.spsLen = 0;
|
||||
settings->codecSpecific.H264.ppsData = NULL;
|
||||
settings->codecSpecific.H264.ppsLen = 0;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#ifdef VIDEOCODEC_I420
|
||||
case VCM_I420_IDX: {
|
||||
strncpy(settings->plName, "I420", 5);
|
||||
@@ -316,8 +340,7 @@ bool VCMCodecDataBase::RequiresEncoderReset(const VideoCodec& new_send_codec) {
|
||||
case kVideoCodecVP8:
|
||||
if (memcmp(&new_send_codec.codecSpecific.VP8,
|
||||
&send_codec_.codecSpecific.VP8,
|
||||
sizeof(new_send_codec.codecSpecific.VP8)) !=
|
||||
0) {
|
||||
sizeof(new_send_codec.codecSpecific.VP8)) != 0) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@@ -327,6 +350,12 @@ bool VCMCodecDataBase::RequiresEncoderReset(const VideoCodec& new_send_codec) {
|
||||
case kVideoCodecI420:
|
||||
case kVideoCodecRED:
|
||||
case kVideoCodecULPFEC:
|
||||
case kVideoCodecH264:
|
||||
if (memcmp(&new_send_codec.codecSpecific.H264,
|
||||
&send_codec_.codecSpecific.H264,
|
||||
sizeof(new_send_codec.codecSpecific.H264)) != 0) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
// Unknown codec type, reset just to be sure.
|
||||
case kVideoCodecUnknown:
|
||||
@@ -619,6 +648,7 @@ VCMGenericDecoder* VCMCodecDataBase::CreateDecoder(VideoCodecType type) const {
|
||||
return new VCMGenericDecoder(*(new I420Decoder));
|
||||
#endif
|
||||
default:
|
||||
LOG(LS_WARNING) << "No internal decoder of this type exists.";
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,10 +39,15 @@ inline uint32_t MaskWord64ToUWord32(int64_t w64)
|
||||
#else
|
||||
#define VCM_VP8_IDX VCM_NO_CODEC_IDX
|
||||
#endif
|
||||
#ifdef VIDEOCODEC_I420
|
||||
#define VCM_I420_IDX VCM_VP8_IDX + 1
|
||||
#ifdef VIDEOCODEC_H264
|
||||
#define VCM_H264_IDX VCM_VP8_IDX + 1
|
||||
#else
|
||||
#define VCM_I420_IDX VCM_VP8_IDX
|
||||
#define VCM_H264_IDX VCM_VP8_IDX
|
||||
#endif
|
||||
#ifdef VIDEOCODEC_I420
|
||||
#define VCM_I420_IDX VCM_H264_IDX + 1
|
||||
#else
|
||||
#define VCM_I420_IDX VCM_H264_IDX
|
||||
#endif
|
||||
#define VCM_NUM_VIDEO_CODECS_AVAILABLE VCM_I420_IDX + 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user