Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: content/renderer/media/gpu/rtc_video_encoder.cc

Issue 2973253002: Revert of TCVideoEncoder: Report H264 profile information to WebRTC (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/gpu/rtc_video_encoder.cc
diff --git a/content/renderer/media/gpu/rtc_video_encoder.cc b/content/renderer/media/gpu/rtc_video_encoder.cc
index 8c671e583fc81e9ca03d4774145c170eb50997a6..2185d7ed83c3ae5a63cc2b609564fc4b7c046a7e 100644
--- a/content/renderer/media/gpu/rtc_video_encoder.cc
+++ b/content/renderer/media/gpu/rtc_video_encoder.cc
@@ -47,16 +47,25 @@
DISALLOW_IMPLICIT_CONSTRUCTORS(RTCTimestamps);
};
-webrtc::VideoCodecType ProfileToWebRtcVideoCodecType(
- media::VideoCodecProfile profile) {
- if (profile >= media::VP8PROFILE_MIN && profile <= media::VP8PROFILE_MAX) {
- return webrtc::kVideoCodecVP8;
- } else if (profile >= media::H264PROFILE_MIN &&
- profile <= media::H264PROFILE_MAX) {
- return webrtc::kVideoCodecH264;
- }
- NOTREACHED() << "Invalid profile " << GetProfileName(profile);
- return webrtc::kVideoCodecUnknown;
+// 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::kVideoCodecVP9:
+ return media::VP9PROFILE_MIN;
+ case webrtc::kVideoCodecH264:
+ // TODO(magjed): WebRTC is only using Baseline profile for now. Update
+ // once http://crbug/webrtc/6337 is fixed.
+ return media::H264PROFILE_BASELINE;
+ default:
+ NOTREACHED() << "Unrecognized video codec type";
+ return media::VIDEO_CODEC_PROFILE_UNKNOWN;
+ }
}
// Populates struct webrtc::RTPFragmentationHeader for H264 codec.
@@ -783,12 +792,12 @@
}
RTCVideoEncoder::RTCVideoEncoder(
- media::VideoCodecProfile profile,
+ webrtc::VideoCodecType type,
media::GpuVideoAcceleratorFactories* gpu_factories)
- : profile_(profile),
+ : video_codec_type_(type),
gpu_factories_(gpu_factories),
gpu_task_runner_(gpu_factories->GetTaskRunner()) {
- DVLOG(1) << "RTCVideoEncoder(): profile=" << GetProfileName(profile);
+ DVLOG(1) << "RTCVideoEncoder(): codec type=" << type;
}
RTCVideoEncoder::~RTCVideoEncoder() {
@@ -809,7 +818,9 @@
Release();
}
- impl_ = new Impl(gpu_factories_, ProfileToWebRtcVideoCodecType(profile_));
+ impl_ = new Impl(gpu_factories_, video_codec_type_);
+ const media::VideoCodecProfile profile = WebRTCVideoCodecToVideoCodecProfile(
+ impl_->video_codec_type(), codec_settings);
base::WaitableEvent initialization_waiter(
base::WaitableEvent::ResetPolicy::MANUAL,
@@ -817,14 +828,17 @@
int32_t initialization_retval = WEBRTC_VIDEO_CODEC_UNINITIALIZED;
gpu_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&RTCVideoEncoder::Impl::CreateAndInitializeVEA, impl_,
+ base::Bind(&RTCVideoEncoder::Impl::CreateAndInitializeVEA,
+ impl_,
gfx::Size(codec_settings->width, codec_settings->height),
- codec_settings->startBitrate, profile_, &initialization_waiter,
+ codec_settings->startBitrate,
+ profile,
+ &initialization_waiter,
&initialization_retval));
// webrtc::VideoEncoder expects this call to be synchronous.
initialization_waiter.Wait();
- RecordInitEncodeUMA(initialization_retval, profile_);
+ RecordInitEncodeUMA(initialization_retval, profile);
return initialization_retval;
}
« no previous file with comments | « content/renderer/media/gpu/rtc_video_encoder.h ('k') | content/renderer/media/gpu/rtc_video_encoder_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698