| Index: content/renderer/media/rtc_video_encoder.cc
|
| diff --git a/content/renderer/media/rtc_video_encoder.cc b/content/renderer/media/rtc_video_encoder.cc
|
| index 99e963a96b27fe7ff7532447e20541ca50c12669..7d47fea72556e98a76ff3acebb1a28e1a7593712 100644
|
| --- a/content/renderer/media/rtc_video_encoder.cc
|
| +++ b/content/renderer/media/rtc_video_encoder.cc
|
| @@ -30,6 +30,30 @@ namespace content {
|
|
|
| namespace {
|
|
|
| +// Translate from webrtc::VideoCodecType and webrtc::VideoCodec to
|
| +// media::VideoCodecProfile.
|
| +media::VideoCodecProfile WebRTCVideoCodecToVideoCodecProfile(
|
| + webrtc::VideoCodecType type, const webrtc::VideoCodec* codec_settings) {
|
| + DCHECK_EQ(type, codec_settings->codecType);
|
| + switch (type) {
|
| + case webrtc::kVideoCodecVP8:
|
| + return media::VP8PROFILE_ANY;
|
| + case webrtc::kVideoCodecH264: {
|
| + switch (codec_settings->codecSpecific.H264.profile) {
|
| + case webrtc::kProfileBase:
|
| + return media::H264PROFILE_BASELINE;
|
| + case webrtc::kProfileMain:
|
| + return media::H264PROFILE_MAIN;
|
| + }
|
| + }
|
| + case webrtc::kVideoCodecGeneric:
|
| + return media::H264PROFILE_MAIN;
|
| + default:
|
| + NOTREACHED() << "Unrecognized video codec type";
|
| + return media::VIDEO_CODEC_PROFILE_UNKNOWN;
|
| + }
|
| +}
|
| +
|
| // Populates struct webrtc::RTPFragmentationHeader for H264 codec.
|
| // Each entry specifies the offset and length (excluding start code) of a NALU.
|
| // Returns true if successful.
|
| @@ -546,15 +570,13 @@ void RTCVideoEncoder::Impl::SignalAsyncWaiter(int32_t retval) {
|
|
|
| RTCVideoEncoder::RTCVideoEncoder(
|
| webrtc::VideoCodecType type,
|
| - media::VideoCodecProfile profile,
|
| const scoped_refptr<media::GpuVideoAcceleratorFactories>& gpu_factories)
|
| : video_codec_type_(type),
|
| - video_codec_profile_(profile),
|
| gpu_factories_(gpu_factories),
|
| encoded_image_callback_(NULL),
|
| impl_status_(WEBRTC_VIDEO_CODEC_UNINITIALIZED),
|
| weak_factory_(this) {
|
| - DVLOG(1) << "RTCVideoEncoder(): profile=" << profile;
|
| + DVLOG(1) << "RTCVideoEncoder(): codec type=" << type;
|
| }
|
|
|
| RTCVideoEncoder::~RTCVideoEncoder() {
|
| @@ -574,6 +596,9 @@ int32_t RTCVideoEncoder::InitEncode(const webrtc::VideoCodec* codec_settings,
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| DCHECK(!impl_.get());
|
|
|
| + media::VideoCodecProfile profile = WebRTCVideoCodecToVideoCodecProfile(
|
| + video_codec_type_, codec_settings);
|
| +
|
| weak_factory_.InvalidateWeakPtrs();
|
| impl_ = new Impl(weak_factory_.GetWeakPtr(), gpu_factories_);
|
| base::WaitableEvent initialization_waiter(true, false);
|
| @@ -584,13 +609,13 @@ int32_t RTCVideoEncoder::InitEncode(const webrtc::VideoCodec* codec_settings,
|
| impl_,
|
| gfx::Size(codec_settings->width, codec_settings->height),
|
| codec_settings->startBitrate,
|
| - video_codec_profile_,
|
| + profile,
|
| &initialization_waiter,
|
| &initialization_retval));
|
|
|
| // webrtc::VideoEncoder expects this call to be synchronous.
|
| initialization_waiter.Wait();
|
| - RecordInitEncodeUMA(initialization_retval);
|
| + RecordInitEncodeUMA(initialization_retval, profile);
|
| return initialization_retval;
|
| }
|
|
|
| @@ -745,12 +770,13 @@ void RTCVideoEncoder::NotifyError(int32_t error) {
|
| impl_ = NULL;
|
| }
|
|
|
| -void RTCVideoEncoder::RecordInitEncodeUMA(int32_t init_retval) {
|
| +void RTCVideoEncoder::RecordInitEncodeUMA(
|
| + int32_t init_retval, media::VideoCodecProfile profile) {
|
| UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoEncoderInitEncodeSuccess",
|
| init_retval == WEBRTC_VIDEO_CODEC_OK);
|
| if (init_retval == WEBRTC_VIDEO_CODEC_OK) {
|
| UMA_HISTOGRAM_ENUMERATION("Media.RTCVideoEncoderProfile",
|
| - video_codec_profile_,
|
| + profile,
|
| media::VIDEO_CODEC_PROFILE_MAX + 1);
|
| }
|
| }
|
|
|