Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit c03437d

Browse files
committed
Renable hevc support for android (#80)
1 parent e41cc21 commit c03437d

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

sdk/android/api/org/webrtc/HardwareVideoEncoderFactory.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import static org.webrtc.MediaCodecUtils.EXYNOS_PREFIX;
1414
import static org.webrtc.MediaCodecUtils.INTEL_PREFIX;
1515
import static org.webrtc.MediaCodecUtils.QCOM_PREFIX;
16+
import static org.webrtc.MediaCodecUtils.HISI_PREFIX;
1617

1718
import android.media.MediaCodecInfo;
1819
import android.media.MediaCodecList;
@@ -213,6 +214,8 @@ private boolean isHardwareSupportedInCurrentSdkVp8(MediaCodecInfo info) {
213214
String name = info.getName();
214215
// QCOM Vp8 encoder is supported in KITKAT or later.
215216
return (name.startsWith(QCOM_PREFIX) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
217+
// Hisi VP8 encoder seems to be supported. Needs more testing.
218+
|| (name.startsWith(HISI_PREFIX) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
216219
// Exynos VP8 encoder is supported in M or later.
217220
|| (name.startsWith(EXYNOS_PREFIX) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
218221
// Intel Vp8 encoder is supported in LOLLIPOP or later, with the intel encoder enabled.
@@ -222,7 +225,7 @@ private boolean isHardwareSupportedInCurrentSdkVp8(MediaCodecInfo info) {
222225

223226
private boolean isHardwareSupportedInCurrentSdkVp9(MediaCodecInfo info) {
224227
String name = info.getName();
225-
return (name.startsWith(QCOM_PREFIX) || name.startsWith(EXYNOS_PREFIX))
228+
return (name.startsWith(QCOM_PREFIX) || name.startsWith(EXYNOS_PREFIX) || name.startsWith(HISI_PREFIX))
226229
// Both QCOM and Exynos VP9 encoders are supported in N or later.
227230
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
228231
}
@@ -246,7 +249,9 @@ private boolean isHardwareSupportedInCurrentSdkH265(MediaCodecInfo info) {
246249
return (name.startsWith(QCOM_PREFIX) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
247250
// Exynos H265 encoder is supported in LOLLIPOP or later.
248251
|| (name.startsWith(EXYNOS_PREFIX)
249-
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP);
252+
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
253+
// Hisi VP8 encoder seems to be supported. Needs more testing.
254+
|| (name.startsWith(HISI_PREFIX) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT);
250255
}
251256

252257
private boolean isMediaCodecAllowed(MediaCodecInfo info) {

sdk/android/src/java/org/webrtc/MediaCodecUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class MediaCodecUtils {
3131
static final String QCOM_PREFIX = "OMX.qcom.";
3232
static final String[] SOFTWARE_IMPLEMENTATION_PREFIXES = {
3333
"OMX.google.", "OMX.SEC.", "c2.android"};
34+
static final String HISI_PREFIX = "OMX.hisi.";
3435

3536
// NV12 color format supported by QCOM codec, but not declared in MediaCodec -
3637
// see /hardware/qcom/media/mm-core/inc/OMX_QCOMExtns.h

sdk/android/src/jni/video_encoder_wrapper.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
#include <utility>
1414

1515
#include "common_video/h264/h264_common.h"
16+
#ifndef DISABLE_H265
17+
#include "common_video/h265/h265_common.h"
18+
#endif
1619
#include "modules/video_coding/include/video_codec_interface.h"
1720
#include "modules/video_coding/include/video_error_codes.h"
1821
#include "modules/video_coding/utility/vp8_header_parser.h"

0 commit comments

Comments
 (0)