mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 911046 - Part 5: Register H.264 external codec for B2G. r=jesup, ekr
This commit is contained in:
parent
181e666d70
commit
2a15422518
@ -78,6 +78,12 @@ struct VideoCodecConfig
|
||||
mMaxFrameRate(0),
|
||||
mLoadManager(load_manager)
|
||||
{
|
||||
// Replace codec name here because WebRTC.org code has a whitelist of
|
||||
// supported video codec in |webrtc::ViECodecImpl::CodecValid()| and will
|
||||
// reject registration of those not in it.
|
||||
// TODO: bug 995884 to support H.264 in WebRTC.org code.
|
||||
if (mName == "H264_P0")
|
||||
mName = "I420";
|
||||
}
|
||||
|
||||
VideoCodecConfig(int type,
|
||||
@ -93,6 +99,12 @@ struct VideoCodecConfig
|
||||
mMaxFrameRate(max_fr),
|
||||
mLoadManager(load_manager)
|
||||
{
|
||||
// Replace codec name here because WebRTC.org code has a whitelist of
|
||||
// supported video codec in |webrtc::ViECodecImpl::CodecValid()| and will
|
||||
// reject registration of those not in it.
|
||||
// TODO: bug 995884 to support H.264 in WebRTC.org code.
|
||||
if (mName == "H264_P0")
|
||||
mName = "I420";
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,6 +37,10 @@
|
||||
#include <sslproto.h>
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef MOZ_OMX_ENCODER
|
||||
#include "OMXVideoCodec.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include "ccsdp.h"
|
||||
#include "vcm.h"
|
||||
@ -54,6 +58,11 @@ extern void lsm_update_active_tone(vcm_tones_t tone, cc_call_handle_t call_handl
|
||||
extern void lsm_stop_multipart_tone_timer(void);
|
||||
extern void lsm_stop_continuous_tone_timer(void);
|
||||
|
||||
static int vcmEnsureExternalCodec(
|
||||
const mozilla::RefPtr<mozilla::VideoSessionConduit>& conduit,
|
||||
mozilla::VideoCodecConfig* config,
|
||||
bool send);
|
||||
|
||||
}//end extern "C"
|
||||
|
||||
static const char* logTag = "VcmSipccBinding";
|
||||
@ -1693,6 +1702,9 @@ static int vcmRxStartICE_m(cc_mcapid_t mcap_id,
|
||||
ccsdpCodecName(payloads[i].codec_type),
|
||||
payloads[i].video.rtcp_fb_types,
|
||||
pc.impl()->load_manager());
|
||||
if (vcmEnsureExternalCodec(conduit, config_raw, false)) {
|
||||
continue;
|
||||
}
|
||||
configs.push_back(config_raw);
|
||||
}
|
||||
|
||||
@ -2100,6 +2112,45 @@ short vcmTxOpen(cc_mcapid_t mcap_id,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add external H.264 video codec.
|
||||
*/
|
||||
static int vcmEnsureExternalCodec(
|
||||
const mozilla::RefPtr<mozilla::VideoSessionConduit>& conduit,
|
||||
mozilla::VideoCodecConfig* config,
|
||||
bool send)
|
||||
{
|
||||
#ifdef MOZ_OMX_ENCODER
|
||||
// Here we use "I420" to register H.264 because WebRTC.org code has a
|
||||
// whitelist of supported video codec in |webrtc::ViECodecImpl::CodecValid()|
|
||||
// and will reject registration of those not in it.
|
||||
// TODO: bug 995884 to support H.264 in WebRTC.org code.
|
||||
if (config->mName != "I420") {
|
||||
// Do nothing for non-I420 config.
|
||||
return send ? kMediaConduitInvalidSendCodec : kMediaConduitInvalidReceiveCodec;
|
||||
}
|
||||
// Register H.264 codec.
|
||||
if (send) {
|
||||
VideoEncoder* encoder = OMXVideoCodec::CreateEncoder(OMXVideoCodec::CodecType::CODEC_H264);
|
||||
if (encoder) {
|
||||
return conduit->SetExternalSendCodec(config->mType, encoder);
|
||||
} else {
|
||||
return kMediaConduitInvalidSendCodec;
|
||||
}
|
||||
} else {
|
||||
VideoDecoder* decoder = OMXVideoCodec::CreateDecoder(OMXVideoCodec::CodecType::CODEC_H264);
|
||||
if (decoder) {
|
||||
return conduit->SetExternalRecvCodec(config->mType, decoder);
|
||||
} else {
|
||||
return kMediaConduitInvalidReceiveCodec;
|
||||
}
|
||||
}
|
||||
NS_NOTREACHED("Shouldn't get here!");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* start tx stream
|
||||
* Note: For video calls, for a given call_handle there will be
|
||||
@ -2363,7 +2414,13 @@ static int vcmTxStartICE_m(cc_mcapid_t mcap_id,
|
||||
mozilla::VideoSessionConduit::Create(static_cast<VideoSessionConduit *>(rx_conduit.get()));
|
||||
|
||||
// Find the appropriate media conduit config
|
||||
if (!conduit || conduit->ConfigureSendMediaCodec(config))
|
||||
if (!conduit)
|
||||
return VCM_ERROR;
|
||||
|
||||
if (vcmEnsureExternalCodec(conduit, config_raw, true))
|
||||
return VCM_ERROR;
|
||||
|
||||
if (conduit->ConfigureSendMediaCodec(config))
|
||||
return VCM_ERROR;
|
||||
|
||||
pc.impl()->media()->AddConduit(level, false, conduit);
|
||||
@ -3218,4 +3275,3 @@ short vcmGetVideoMaxFr(uint16_t codec,
|
||||
&ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user