Files
platform-external-webrtc/sdk/android/native_unittests/org/webrtc/FakeVideoEncoder.java
Jiwon Jung 5a79d28eba Require 16x16 alignment when using HardwareVideoEncoder for encoding.
It seems the Android CTS tests only verify that 16x16 aligned resolutions
are supported.

This change checks the validity of input frame's size when initialing
or encoding processes are about to start using H/W MediaCodec.

This change has additional APIs to retrieve
|requested_resolution_alignment| and |apply_alignment_to_all_simulcast_layers|
from JAVA VideoEncoder class and its inherited classes. HardwareVideoEncoder
using MediaCodec has values of 16 and true for above variables.

Bug: webrtc:13089
Change-Id: I0c4ebf94eb36da29c2e384a3edf85b82e779b7f9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/229460
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35169}
2021-10-08 13:15:12 +00:00

61 lines
1.6 KiB
Java

/*
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
package org.webrtc;
import org.webrtc.VideoEncoder;
/**
* An implementation of VideoEncoder that is used for testing of functionalities of
* VideoEncoderWrapper.
*/
class FakeVideoEncoder implements VideoEncoder {
@Override
public VideoCodecStatus initEncode(Settings settings, Callback encodeCallback) {
return VideoCodecStatus.OK;
}
@Override
public VideoCodecStatus release() {
return VideoCodecStatus.OK;
}
@Override
public VideoCodecStatus encode(VideoFrame frame, EncodeInfo info) {
return VideoCodecStatus.OK;
}
@Override
public VideoCodecStatus setRateAllocation(BitrateAllocation allocation, int framerate) {
return VideoCodecStatus.OK;
}
@Override
public ScalingSettings getScalingSettings() {
return ScalingSettings.OFF;
}
@Override
public ResolutionBitrateLimits[] getResolutionBitrateLimits() {
ResolutionBitrateLimits resolution_bitrate_limits[] = {
new ResolutionBitrateLimits(/* frameSizePixels = */ 640 * 360,
/* minStartBitrateBps = */ 300000,
/* minBitrateBps = */ 200000,
/* maxBitrateBps = */ 1000000)};
return resolution_bitrate_limits;
}
@Override
public String getImplementationName() {
return "FakeVideoEncoder";
}
}