Bug 1043515: Add max-br and max-mbps H.264 SDP fmtp parameters; update supported h264 level r=ehugg

This commit is contained in:
Randell Jesup 2014-07-27 19:59:46 -04:00
Родитель ad15ee8274
Коммит 6f46d0a0df
6 изменённых файлов: 95 добавлений и 19 удалений

Просмотреть файл

@ -2873,7 +2873,14 @@ uint32_t vcmGetVideoH264ProfileLevelID()
{
// constrained baseline level 1.2
// XXX make variable based on openh264 and OMX support
#ifdef MOZ_WEBRTC_OMX
// Max resolution CIF; we should include max-mbps
return 0x42E00C;
#else
// XXX See bug 1043515 - we may want to support a higher profile than
// 1.3, depending on hardware(?)
return 0x42E00D;
#endif
}
/**
@ -3368,11 +3375,11 @@ int vcmDisableRtcpComponent(const char *peerconnection, int level) {
return ret;
}
static short vcmGetVideoMaxFs_m(uint16_t codec,
int32_t *max_fs) {
static short vcmGetVideoPref_m(uint16_t codec,
const char *pref,
int32_t *ret) {
nsCOMPtr<nsIPrefBranch> branch = VcmSIPCCBinding::getPrefBranch();
if (branch && NS_SUCCEEDED(branch->GetIntPref("media.navigator.video.max_fs",
max_fs))) {
if (branch && NS_SUCCEEDED(branch->GetIntPref(pref, ret))) {
return 0;
}
return VCM_ERROR;
@ -3383,31 +3390,56 @@ short vcmGetVideoMaxFs(uint16_t codec,
short ret;
mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
WrapRunnableNMRet(&vcmGetVideoMaxFs_m,
WrapRunnableNMRet(&vcmGetVideoPref_m,
codec,
"media.navigator.video.max_fs",
max_fs,
&ret));
return ret;
}
static short vcmGetVideoMaxFr_m(uint16_t codec,
int32_t *max_fr) {
nsCOMPtr<nsIPrefBranch> branch = VcmSIPCCBinding::getPrefBranch();
if (branch && NS_SUCCEEDED(branch->GetIntPref("media.navigator.video.max_fr",
max_fr))) {
return 0;
}
return VCM_ERROR;
}
short vcmGetVideoMaxFr(uint16_t codec,
int32_t *max_fr) {
short ret;
mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
WrapRunnableNMRet(&vcmGetVideoMaxFr_m,
WrapRunnableNMRet(&vcmGetVideoPref_m,
codec,
"media.navigator.video.max_fr",
max_fr,
&ret));
return ret;
}
short vcmGetVideoMaxBr(uint16_t codec,
int32_t *max_br) {
short ret;
mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
WrapRunnableNMRet(&vcmGetVideoPref_m,
codec,
"media.navigator.video.h264.max_br",
max_br,
&ret));
return ret;
}
short vcmGetVideoMaxMbps(uint16_t codec,
int32_t *max_mbps) {
short ret;
mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
WrapRunnableNMRet(&vcmGetVideoPref_m,
codec,
"media.navigator.video.h264.max_mbps",
max_mbps,
&ret));
if (ret == VCM_ERROR) {
#ifdef MOZ_WEBRTC_OMX
// Level 1.2; but let's allow CIF@30 or QVGA@30+ by default
*max_mbps = 11880;
ret = 0;
#endif
}
return ret;
}

Просмотреть файл

@ -593,6 +593,28 @@ config_get_video_max_fr(const rtp_ptype codec)
return 0;
}
uint32_t
config_get_video_max_mbps(const rtp_ptype codec)
{
uint32_t max_mbps;
if(vcmGetVideoMaxMbps(codec, (int32_t *) &max_mbps) == 0) {
return max_mbps;
}
return 0;
}
uint32_t
config_get_video_max_br(const rtp_ptype codec)
{
uint32_t max_br;
if(vcmGetVideoMaxBr(codec, (int32_t *) &max_br) == 0) {
return max_br;
}
return 0;
}
uint16_t
sip_config_video_add_codecs (rtp_ptype aSupportedCodecs[],
uint16_t supportedCodecsLen,

Просмотреть файл

@ -294,5 +294,7 @@ int sip_config_get_keepalive_expires();
rtp_ptype sip_config_preferred_codec(void);
uint32_t config_get_video_max_fs(const rtp_ptype codec);
uint32_t config_get_video_max_fr(const rtp_ptype codec);
uint32_t config_get_video_max_mbps(const rtp_ptype codec);
uint32_t config_get_video_max_br(const rtp_ptype codec);
#endif /* PROT_CONFIGMGR_H_ */

Просмотреть файл

@ -1141,6 +1141,8 @@ gsmsdp_set_video_media_attributes (uint32_t media_type, void *cc_sdp_p, uint16_t
void *sdp_p = ((cc_sdp_t*)cc_sdp_p)->src_sdp;
int max_fs = 0;
int max_fr = 0;
int max_br = 0;
int max_mbps = 0;
switch (media_type) {
case RTP_H263:
@ -1211,11 +1213,14 @@ gsmsdp_set_video_media_attributes (uint32_t media_type, void *cc_sdp_p, uint16_t
switch (media_type) {
case RTP_H264_P0:
case RTP_H264_P1:
max_br = config_get_video_max_br((rtp_ptype) media_type); // H264 only
max_mbps = config_get_video_max_mbps((rtp_ptype) media_type); // H264 only
// fall through
case RTP_VP8:
max_fs = config_get_video_max_fs((rtp_ptype) media_type);
max_fr = config_get_video_max_fr((rtp_ptype) media_type);
if (max_fs || max_fr) {
if (max_fs || max_fr || max_br || max_mbps) {
if (!added_fmtp) {
if (sdp_add_new_attr(sdp_p, level, 0, SDP_ATTR_FMTP, &a_inst)
!= SDP_SUCCESS) {
@ -1232,11 +1237,18 @@ gsmsdp_set_video_media_attributes (uint32_t media_type, void *cc_sdp_p, uint16_t
(void) sdp_attr_set_fmtp_max_fs(sdp_p, level, 0, a_inst,
max_fs);
}
if (max_fr) {
(void) sdp_attr_set_fmtp_max_fr(sdp_p, level, 0, a_inst,
max_fr);
}
if (max_br) {
(void) sdp_attr_set_fmtp_max_br(sdp_p, level, 0, a_inst,
max_br);
}
if (max_mbps) {
(void) sdp_attr_set_fmtp_max_mbps(sdp_p, level, 0, a_inst,
max_mbps);
}
}
break;
}

Просмотреть файл

@ -1085,7 +1085,11 @@ int vcmDisableRtcpComponent(const char *peerconnection, int level);
short vcmGetVideoMaxFs(uint16_t codec, int32_t *max_fs);
short vcmGetVideoMaxFr(uint16_t codec, int32_t *max_fs);
short vcmGetVideoMaxFr(uint16_t codec, int32_t *max_fr);
short vcmGetVideoMaxBr(uint16_t codec, int32_t *max_br);
short vcmGetVideoMaxMbps(uint16_t codec, int32_t *max_mbps);
//Using C++ for gips. This is the end of extern "C" above.
#ifdef __cplusplus

Просмотреть файл

@ -295,6 +295,8 @@ pref("media.peerconnection.enabled", true);
pref("media.peerconnection.video.enabled", true);
pref("media.navigator.video.max_fs", 1200); // 640x480 == 1200mb
pref("media.navigator.video.max_fr", 30);
pref("media.navigator.video.h264.max_br", 700); // 8x10
pref("media.navigator.video.h264.max_mbps", 11880); // CIF@30fps
pref("media.peerconnection.video.h264_enabled", false);
pref("media.getusermedia.aec", 4);
#else
@ -304,6 +306,8 @@ pref("media.peerconnection.enabled", true);
pref("media.peerconnection.video.enabled", true);
pref("media.navigator.video.max_fs", 0); // unrestricted
pref("media.navigator.video.max_fr", 0); // unrestricted
pref("media.navigator.video.h264.max_br", 0);
pref("media.navigator.video.h264.max_mbps", 0);
pref("media.peerconnection.video.h264_enabled", false);
pref("media.getusermedia.aec", 1);
#endif