Bug 1137472: Basic VP9 signaling/pipeline/conduit support r=bwc

This commit is contained in:
Randell Jesup 2015-03-03 01:31:33 -05:00
parent c9b6a04ac4
commit 00a74cff8f
11 changed files with 40 additions and 4 deletions

View File

@ -291,7 +291,8 @@ struct JsepVideoCodecDescription : public JsepCodecDescription {
mSpropParameterSets.c_str(),
sizeof(params->sprop_parameter_sets) - 1);
fmtp.PushEntry(mDefaultPt, "", mozilla::Move(params));
} else if (mName == "VP8") {
} else if (mName == "VP8" || mName == "VP9") {
// VP8 and VP9 share the same SDP parameters thus far
UniquePtr<SdpFmtpAttributeList::VP8Parameters> params =
MakeUnique<SdpFmtpAttributeList::VP8Parameters>();
@ -319,10 +320,11 @@ struct JsepVideoCodecDescription : public JsepCodecDescription {
case SdpRtpmapAttributeList::kH264:
LoadH264Parameters(params);
break;
case SdpRtpmapAttributeList::kVP9:
// VP8 and VP9 share the same SDP parameters thus far
case SdpRtpmapAttributeList::kVP8:
LoadVP8Parameters(params);
break;
case SdpRtpmapAttributeList::kVP9:
case SdpRtpmapAttributeList::kiLBC:
case SdpRtpmapAttributeList::kiSAC:
case SdpRtpmapAttributeList::kOpus:

View File

@ -2348,6 +2348,16 @@ JsepSessionImpl::SetupDefaultCodecs()
vp8->mMaxFr = 60;
mCodecs.push_back(vp8);
JsepVideoCodecDescription* vp9 = new JsepVideoCodecDescription(
"121",
"VP9",
90000
);
// Defaults for mandatory params
vp9->mMaxFs = 12288;
vp9->mMaxFr = 60;
mCodecs.push_back(vp9);
JsepVideoCodecDescription* h264_1 = new JsepVideoCodecDescription(
"126",
"H264",

View File

@ -1362,6 +1362,9 @@ WebrtcVideoConduit::CodecConfigToWebRTCCodec(const VideoCodecConfig* codecInfo,
} else if (codecInfo->mName == "VP8") {
cinst.codecType = webrtc::kVideoCodecVP8;
PL_strncpyz(cinst.plName, "VP8", sizeof(cinst.plName));
} else if (codecInfo->mName == "VP9") {
cinst.codecType = webrtc::kVideoCodecVP9;
PL_strncpyz(cinst.plName, "VP9", sizeof(cinst.plName));
} else if (codecInfo->mName == "I420") {
cinst.codecType = webrtc::kVideoCodecI420;
PL_strncpyz(cinst.plName, "I420", sizeof(cinst.plName));

View File

@ -785,7 +785,7 @@ MediaPipelineFactory::EnsureExternalCodec(VideoSessionConduit& aConduit,
VideoCodecConfig* aConfig,
bool aIsSend)
{
if (aConfig->mName == "VP8") {
if (aConfig->mName == "VP8" || aConfig->mName == "VP9") {
return kMediaConduitNoError;
} else if (aConfig->mName == "H264") {
// Register H.264 codec.

View File

@ -903,6 +903,10 @@ PeerConnectionImpl::ConfigureJsepSessionCodecs() {
bool h264Enabled = hardwareH264Supported || softwareH264Enabled;
bool vp9Enabled = false;
branch->GetBoolPref("media.peerconnection.video.vp9_enabled",
&vp9Enabled);
auto& codecs = mJsepSession->Codecs();
// We use this to sort the list of codecs once everything is configured
@ -952,7 +956,11 @@ PeerConnectionImpl::ConfigureJsepSessionCodecs() {
if (hardwareH264Supported) {
comparator.AddHardwareCodec(videoCodec.mDefaultPt);
}
} else if (codec.mName == "VP8") {
} else if (codec.mName == "VP8" || codec.mName == "VP9") {
if (videoCodec.mName == "VP9" && !vp9Enabled) {
videoCodec.mEnabled = false;
break;
}
int32_t maxFs = 0;
branch->GetIntPref("media.navigator.video.max_fs", &maxFs);
if (maxFs <= 0) {
@ -966,6 +974,7 @@ PeerConnectionImpl::ConfigureJsepSessionCodecs() {
maxFr = 60; // We must specify something other than 0
}
videoCodec.mMaxFr = maxFr;
}
}
break;

View File

@ -1014,6 +1014,7 @@ public:
unsigned int max_br;
};
// Also used for VP9 since they share parameters
class VP8Parameters : public Parameters
{
public:

View File

@ -359,6 +359,8 @@ SipccSdpAttributeList::GetCodecType(rtp_ptype type)
return SdpRtpmapAttributeList::kOpus;
case RTP_VP8:
return SdpRtpmapAttributeList::kVP8;
case RTP_VP9:
return SdpRtpmapAttributeList::kVP9;
case RTP_NONE:
// Happens when sipcc doesn't know how to translate to the enum
case RTP_CELP:
@ -645,6 +647,7 @@ SipccSdpAttributeList::LoadFmtp(sdp_t* sdp, uint16_t level)
parameters.reset(h264Parameters);
} break;
case RTP_VP9:
case RTP_VP8: {
SdpFmtpAttributeList::VP8Parameters* vp8Parameters(
new SdpFmtpAttributeList::VP8Parameters);

View File

@ -282,6 +282,8 @@ SipccSdpMediaSection::AddCodec(const std::string& pt, const std::string& name,
codec = SdpRtpmapAttributeList::kPCMA;
} else if (name == "VP8") {
codec = SdpRtpmapAttributeList::kVP8;
} else if (name == "VP9") {
codec = SdpRtpmapAttributeList::kVP9;
} else if (name == "H264") {
codec = SdpRtpmapAttributeList::kH264;
}

View File

@ -326,6 +326,7 @@ const char * ccsdpCodecName(rtp_ptype ptype)
case RTP_ILBC: return "iLBC";
case RTP_OPUS: return "OPUS";
case RTP_VP8: return "VP8";
case RTP_VP9: return "VP9";
case RTP_I420: return "I420";
/* case RTP_ISAC: return "ISAC"; */
}

View File

@ -80,6 +80,7 @@ typedef enum rtp_ptype_
RTP_ILBC = 116, /* used only to make an offer */
RTP_OPUS = 109,
RTP_VP8 = 120,
RTP_VP9 = 121,
RTP_I420 = 124,
RTP_ISAC = 124
} rtp_ptype;

View File

@ -25,6 +25,7 @@ static const char* logTag = "sdp_access";
#define SIPSDP_ATTR_ENCNAME_H263v2 "H263-1998"
#define SIPSDP_ATTR_ENCNAME_H264 "H264"
#define SIPSDP_ATTR_ENCNAME_VP8 "VP8"
#define SIPSDP_ATTR_ENCNAME_VP9 "VP9"
#define SIPSDP_ATTR_ENCNAME_L16_256K "L16"
#define SIPSDP_ATTR_ENCNAME_ISAC "ISAC"
#define SIPSDP_ATTR_ENCNAME_OPUS "opus"
@ -1798,6 +1799,9 @@ rtp_ptype sdp_get_known_payload_type(void *sdp_ptr,
if (cpr_strcasecmp(encname, SIPSDP_ATTR_ENCNAME_VP8) == 0) {
return (RTP_VP8);
}
if (cpr_strcasecmp(encname, SIPSDP_ATTR_ENCNAME_VP9) == 0) {
return (RTP_VP9);
}
}
}
}