Commit 45697ad6 authored by Weiyong Yao's avatar Weiyong Yao Committed by Commit Bot

[Android] Force HW H264 to advise ConstrainedBaseLine

Currently Chrome on Android can only advise BaseLine H264 for HW H264
encoder, while some third party peers only expect ConstrainedBaseLine
during negotiation. This will break down the intercommunication with
others a lot.
Changing the profile id in SDP to CBP can solve this problem, which means
the peer can actually decode the stream from Android HW H264.

So the easiest solution is to fake the H264 profile id to CBP on Android,
which will violate the spec a bit, but can solve major intercommunication
compatibility issues right now.

Bug: 793038
Change-Id: I8480aa624c445f30c5defe75bdc378dca63e130a
Reviewed-on: https://chromium-review.googlesource.com/815294Reviewed-by: default avatarPawel Osciak <posciak@chromium.org>
Commit-Queue: Weiyong Yao <braveyao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523980}
parent bf0867c3
......@@ -7,6 +7,7 @@
#include <memory>
#include "base/command_line.h"
#include "build/build_config.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/feature_h264_with_openh264_ffmpeg.h"
......@@ -46,7 +47,15 @@ base::Optional<cricket::VideoCodec> VEAToWebRTCCodec(
webrtc::H264::Profile h264_profile;
switch (profile.profile) {
case media::H264PROFILE_BASELINE:
#if defined(OS_ANDROID)
// Force HW H264 on Android to be CBP for most compatibility, since:
// - Only HW H264 is available on Android at present.
// - MediaCodec only advise BP, which works same as CBP in most cases.
// - Some peers only expect CBP in negotiation.
h264_profile = webrtc::H264::kProfileConstrainedBaseline;
#else
h264_profile = webrtc::H264::kProfileBaseline;
#endif
break;
case media::H264PROFILE_MAIN:
h264_profile = webrtc::H264::kProfileMain;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment