mirror of
https://github.com/samsonjs/media.git
synced 2026-03-31 10:25:48 +00:00
Tests: Set SSIM decoder KEY_PRIORITY to 1.
This reduces the priority to best effort (from the default that seems to be best effort), and allows us to run SSIM even on 8k24fps video. Without this CL, start()'ing a second codec may result in a MediaCodec.CodecException. Tested to confirm that transformation8k24(): * fails deterministically without this CL, or with KEY_PRIORITY set to 0. * succeeds deterministically after this CL (~18s on Samsung Z Fold 4) PiperOrigin-RevId: 490570416
This commit is contained in:
parent
87e98b483b
commit
6ca67af455
3 changed files with 12 additions and 8 deletions
|
|
@ -21,6 +21,7 @@ import static com.google.android.exoplayer2.util.MimeTypes.VIDEO_H264;
|
|||
import static com.google.android.exoplayer2.util.MimeTypes.VIDEO_H265;
|
||||
|
||||
import android.content.Context;
|
||||
import android.media.MediaFormat;
|
||||
import android.os.Build;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.C;
|
||||
|
|
@ -43,6 +44,13 @@ import org.json.JSONObject;
|
|||
public final class AndroidTestUtil {
|
||||
private static final String TAG = "AndroidTestUtil";
|
||||
|
||||
/** A realtime {@linkplain MediaFormat#KEY_PRIORITY encoder priority}. */
|
||||
public static final int MEDIA_CODEC_PRIORITY_REALTIME = 0;
|
||||
/**
|
||||
* A non-realtime (as fast as possible) {@linkplain MediaFormat#KEY_PRIORITY encoder priority}.
|
||||
*/
|
||||
public static final int MEDIA_CODEC_PRIORITY_NON_REALTIME = 1;
|
||||
|
||||
// Format values are sourced from `mediainfo` command.
|
||||
|
||||
public static final String MP4_ASSET_URI_STRING = "asset:///media/mp4/sample.mp4";
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package com.google.android.exoplayer2.transformer;
|
||||
|
||||
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MEDIA_CODEC_PRIORITY_NON_REALTIME;
|
||||
import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
|
||||
import static com.google.android.exoplayer2.util.Assertions.checkState;
|
||||
import static com.google.android.exoplayer2.util.Assertions.checkStateNotNull;
|
||||
|
|
@ -232,6 +233,7 @@ public final class SsimHelper {
|
|||
|
||||
String sampleMimeType = checkNotNull(mediaFormat.getString(MediaFormat.KEY_MIME));
|
||||
mediaFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, MEDIA_CODEC_COLOR_SPACE);
|
||||
mediaFormat.setInteger(MediaFormat.KEY_PRIORITY, MEDIA_CODEC_PRIORITY_NON_REALTIME);
|
||||
this.mediaFormat = mediaFormat;
|
||||
mediaCodec = MediaCodec.createDecoderByType(sampleMimeType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,12 @@
|
|||
|
||||
package com.google.android.exoplayer2.transformer.mh.analysis;
|
||||
|
||||
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MEDIA_CODEC_PRIORITY_NON_REALTIME;
|
||||
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MEDIA_CODEC_PRIORITY_REALTIME;
|
||||
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.recordTestSkipped;
|
||||
import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
|
||||
|
||||
import android.content.Context;
|
||||
import android.media.MediaFormat;
|
||||
import android.net.Uri;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import com.google.android.exoplayer2.MediaItem;
|
||||
|
|
@ -44,13 +45,6 @@ import org.junit.runners.Parameterized.Parameters;
|
|||
@RunWith(Parameterized.class)
|
||||
public class EncoderPerformanceAnalysisTest {
|
||||
|
||||
/** A realtime {@linkplain MediaFormat#KEY_PRIORITY encoder priority}. */
|
||||
private static final int MEDIA_CODEC_PRIORITY_REALTIME = 0;
|
||||
/**
|
||||
* A non-realtime (as fast as possible) {@linkplain MediaFormat#KEY_PRIORITY encoder priority}.
|
||||
*/
|
||||
private static final int MEDIA_CODEC_PRIORITY_NON_REALTIME = 1;
|
||||
|
||||
private static final ImmutableList<String> INPUT_FILES =
|
||||
ImmutableList.of(
|
||||
AndroidTestUtil.MP4_ASSET_WITH_INCREASING_TIMESTAMPS_320W_240H_15S_URI_STRING,
|
||||
|
|
|
|||
Loading…
Reference in a new issue