Enable HW video decoding on Qualcomm devices.
Parallel decoding and encoding problem is fixed now (b/16353967), so it is possible to start using Qualcomm VP8 HW decoder. Bitrate overshoots should be fixed as well. BUG= R=tkchin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/26489004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7215 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -67,7 +67,7 @@ class MediaCodecVideoDecoder {
|
|||||||
private static final String VP8_MIME_TYPE = "video/x-vnd.on2.vp8";
|
private static final String VP8_MIME_TYPE = "video/x-vnd.on2.vp8";
|
||||||
// List of supported HW VP8 decoders.
|
// List of supported HW VP8 decoders.
|
||||||
private static final String[] supportedHwCodecPrefixes =
|
private static final String[] supportedHwCodecPrefixes =
|
||||||
{"OMX.Nvidia."};
|
{"OMX.qcom.", "OMX.Nvidia." };
|
||||||
// NV12 color format supported by QCOM codec, but not declared in MediaCodec -
|
// NV12 color format supported by QCOM codec, but not declared in MediaCodec -
|
||||||
// see /hardware/qcom/media/mm-core/inc/OMX_QCOMExtns.h
|
// see /hardware/qcom/media/mm-core/inc/OMX_QCOMExtns.h
|
||||||
private static final int
|
private static final int
|
||||||
|
@ -144,15 +144,6 @@ class MediaCodecVideoEncoder {
|
|||||||
return findVp8HwEncoder() != null;
|
return findVp8HwEncoder() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int bitRate(int kbps) {
|
|
||||||
// webrtc "kilo" means 1000, not 1024. Apparently.
|
|
||||||
// (and the price for overshooting is frame-dropping as webrtc enforces its
|
|
||||||
// bandwidth estimation, which is unpleasant).
|
|
||||||
// Since the HW encoder in the N5 overshoots, we clamp to a bit less than
|
|
||||||
// the requested rate. Sad but true. Bug 3194.
|
|
||||||
return kbps * 950;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkOnMediaCodecThread() {
|
private void checkOnMediaCodecThread() {
|
||||||
if (mediaCodecThread.getId() != Thread.currentThread().getId()) {
|
if (mediaCodecThread.getId() != Thread.currentThread().getId()) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
@ -177,7 +168,7 @@ class MediaCodecVideoEncoder {
|
|||||||
try {
|
try {
|
||||||
MediaFormat format =
|
MediaFormat format =
|
||||||
MediaFormat.createVideoFormat(VP8_MIME_TYPE, width, height);
|
MediaFormat.createVideoFormat(VP8_MIME_TYPE, width, height);
|
||||||
format.setInteger(MediaFormat.KEY_BIT_RATE, bitRate(kbps));
|
format.setInteger(MediaFormat.KEY_BIT_RATE, 1000 * kbps);
|
||||||
format.setInteger("bitrate-mode", VIDEO_ControlRateConstant);
|
format.setInteger("bitrate-mode", VIDEO_ControlRateConstant);
|
||||||
format.setInteger(MediaFormat.KEY_COLOR_FORMAT, properties.colorFormat);
|
format.setInteger(MediaFormat.KEY_COLOR_FORMAT, properties.colorFormat);
|
||||||
// Default WebRTC settings
|
// Default WebRTC settings
|
||||||
@ -248,7 +239,7 @@ class MediaCodecVideoEncoder {
|
|||||||
Log.v(TAG, "setRates: " + kbps + " kbps. Fps: " + frameRateIgnored);
|
Log.v(TAG, "setRates: " + kbps + " kbps. Fps: " + frameRateIgnored);
|
||||||
try {
|
try {
|
||||||
Bundle params = new Bundle();
|
Bundle params = new Bundle();
|
||||||
params.putInt(MediaCodec.PARAMETER_KEY_VIDEO_BITRATE, bitRate(kbps));
|
params.putInt(MediaCodec.PARAMETER_KEY_VIDEO_BITRATE, 1000 * kbps);
|
||||||
mediaCodec.setParameters(params);
|
mediaCodec.setParameters(params);
|
||||||
return true;
|
return true;
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
|
Reference in New Issue
Block a user