Bug 1043515: Add support for a preferred codec to be chosen/offered first always r=ehugg

This commit is contained in:
Randell Jesup 2014-07-27 20:00:35 -04:00
Родитель 675707ecd5
Коммит 873776ee8f
3 изменённых файлов: 39 добавлений и 0 удалений

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

@ -3443,3 +3443,15 @@ short vcmGetVideoMaxMbps(uint16_t codec,
}
return ret;
}
short vcmGetVideoPreferredCodec(int32_t *preferred_codec) {
short ret;
mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
WrapRunnableNMRet(&vcmGetVideoPref_m,
(uint16_t)0,
"media.navigator.video.preferred_codec",
preferred_codec,
&ret));
return ret;
}

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

@ -461,6 +461,13 @@ sip_config_get_display_name (line_t line, char *buffer, int buffer_len)
rtp_ptype
sip_config_preferred_codec (void)
{
#if 1
uint32_t codec;
if(vcmGetVideoPreferredCodec((int32_t *) &codec) == 0) {
return (rtp_ptype) codec;
}
#else
key_table_entry_t cfg_preferred_codec;
config_get_value(CFGID_PREFERRED_CODEC, &cfg_preferred_codec,
@ -470,6 +477,7 @@ sip_config_preferred_codec (void)
/* The configuration has preferred codec configured */
return (cfg_preferred_codec.value);
}
#endif
/* No preferred codec configured */
return (RTP_NONE);
}
@ -656,6 +664,7 @@ sip_config_video_supported_codecs_get (rtp_ptype aSupportedCodecs[],
uint16_t supportedCodecsLen, boolean isOffer)
{
uint16_t count = 0;
rtp_ptype pref_codec;
int codec_mask;
int hw_codec_mask = vcmGetVideoCodecList(VCM_DSP_FULLDUPLEX_HW);
int gmp_codec_mask = vcmGetVideoCodecList(VCM_DSP_FULLDUPLEX_GMP);
@ -680,6 +689,22 @@ sip_config_video_supported_codecs_get (rtp_ptype aSupportedCodecs[],
count += sip_config_video_add_codecs(&aSupportedCodecs[count],
supportedCodecsLen, gmp_codec_mask);
// Now promote the preferred codec if any
pref_codec = sip_config_preferred_codec();
if (pref_codec != RTP_NONE) {
int i,j;
for (i = 1; i < count; i++) {
if (aSupportedCodecs[i] == pref_codec) {
// bump it to the front; bump all the rest down
for (j = i; j > 0; j--) {
aSupportedCodecs[j] = aSupportedCodecs[j-1];
}
aSupportedCodecs[0] = pref_codec;
return count;
}
}
// preferred not found, oh well
}
return count;
}

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

@ -1091,6 +1091,8 @@ short vcmGetVideoMaxBr(uint16_t codec, int32_t *max_br);
short vcmGetVideoMaxMbps(uint16_t codec, int32_t *max_mbps);
short vcmGetVideoPreferredCodec(int32_t *preferred_codec);
//Using C++ for gips. This is the end of extern "C" above.
#ifdef __cplusplus
}