diff options
author | Harish Mahendrakar <harish.mahendrakar@ittiam.com> | 2015-04-18 10:04:39 +0530 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2015-05-05 11:05:22 -0700 |
commit | 34265cd94f76cc18648c310e4f120d280bf3a0a4 (patch) | |
tree | e84dafa7b195c5edb83f24d5db11bd40ca61df3e /media | |
parent | def4c0c49aeebccbb42d9b82901a7de81782baad (diff) | |
download | frameworks_base-34265cd94f76cc18648c310e4f120d280bf3a0a4.zip frameworks_base-34265cd94f76cc18648c310e4f120d280bf3a0a4.tar.gz frameworks_base-34265cd94f76cc18648c310e4f120d280bf3a0a4.tar.bz2 |
media: Added MPEG2 profile/levels and tests
Bug: 20852831
Change-Id: I172f2f08c30d12bf684f32a52db64823cc286d35
Diffstat (limited to 'media')
4 files changed, 101 insertions, 5 deletions
diff --git a/media/java/android/media/MediaCodecInfo.java b/media/java/android/media/MediaCodecInfo.java index 974c9af..89d419a 100644 --- a/media/java/android/media/MediaCodecInfo.java +++ b/media/java/android/media/MediaCodecInfo.java @@ -1733,6 +1733,72 @@ public final class MediaCodecInfo { maxBlocks, maxBlocksPerSecond, 16 /* blockWidth */, 16 /* blockHeight */, 1 /* widthAlignment */, 1 /* heightAlignment */); + } else if (mime.equalsIgnoreCase(MediaFormat.MIMETYPE_VIDEO_MPEG2)) { + int maxWidth = 11, maxHeight = 9, maxRate = 15; + maxBlocks = 99; + maxBlocksPerSecond = 1485; + maxBps = 64000; + for (CodecProfileLevel profileLevel: profileLevels) { + int MBPS = 0, FS = 0, BR = 0, FR = 0, W = 0, H = 0; + boolean supported = true; + switch (profileLevel.profile) { + case CodecProfileLevel.MPEG2ProfileSimple: + switch (profileLevel.level) { + case CodecProfileLevel.MPEG2LevelML: + FR = 30; W = 45; H = 36; MBPS = 48600; FS = 1620; BR = 15000; break; + default: + Log.w(TAG, "Unrecognized profile/level " + + profileLevel.profile + "/" + + profileLevel.level + " for " + mime); + errors |= ERROR_UNRECOGNIZED; + } + break; + case CodecProfileLevel.MPEG2ProfileMain: + switch (profileLevel.level) { + case CodecProfileLevel.MPEG2LevelLL: + FR = 30; W = 22; H = 18; MBPS = 11880; FS = 396; BR = 4000; break; + case CodecProfileLevel.MPEG2LevelML: + FR = 30; W = 45; H = 36; MBPS = 48600; FS = 1620; BR = 15000; break; + case CodecProfileLevel.MPEG2LevelH14: + FR = 60; W = 90; H = 68; MBPS = 367200; FS = 6120; BR = 60000; break; + case CodecProfileLevel.MPEG2LevelHL: + FR = 60; W = 120; H = 68; MBPS = 489600; FS = 8160; BR = 80000; break; + default: + Log.w(TAG, "Unrecognized profile/level " + + profileLevel.profile + "/" + + profileLevel.level + " for " + mime); + errors |= ERROR_UNRECOGNIZED; + } + break; + case CodecProfileLevel.MPEG2Profile422: + case CodecProfileLevel.MPEG2ProfileSNR: + case CodecProfileLevel.MPEG2ProfileSpatial: + case CodecProfileLevel.MPEG2ProfileHigh: + Log.i(TAG, "Unsupported profile " + + profileLevel.profile + " for " + mime); + errors |= ERROR_UNSUPPORTED; + supported = false; + break; + default: + Log.w(TAG, "Unrecognized profile " + + profileLevel.profile + " for " + mime); + errors |= ERROR_UNRECOGNIZED; + } + if (supported) { + errors &= ~ERROR_NONE_SUPPORTED; + } + maxBlocksPerSecond = Math.max(MBPS, maxBlocksPerSecond); + maxBlocks = Math.max(FS, maxBlocks); + maxBps = Math.max(BR * 1000, maxBps); + maxWidth = Math.max(W, maxWidth); + maxHeight = Math.max(H, maxHeight); + maxRate = Math.max(FR, maxRate); + } + applyMacroBlockLimits(maxWidth, maxHeight, + maxBlocks, maxBlocksPerSecond, + 16 /* blockWidth */, 16 /* blockHeight */, + 1 /* widthAlignment */, 1 /* heightAlignment */); + mFrameRateRange = mFrameRateRange.intersect(12, maxRate); } else if (mime.equalsIgnoreCase(MediaFormat.MIMETYPE_VIDEO_MPEG4)) { int maxWidth = 11, maxHeight = 9, maxRate = 15; maxBlocks = 99; @@ -2343,6 +2409,20 @@ public final class MediaCodecInfo { public static final int MPEG4Level4a = 0x40; public static final int MPEG4Level5 = 0x80; + // from OMX_VIDEO_MPEG2PROFILETYPE + public static final int MPEG2ProfileSimple = 0x00; + public static final int MPEG2ProfileMain = 0x01; + public static final int MPEG2Profile422 = 0x02; + public static final int MPEG2ProfileSNR = 0x03; + public static final int MPEG2ProfileSpatial = 0x04; + public static final int MPEG2ProfileHigh = 0x05; + + // from OMX_VIDEO_MPEG2LEVELTYPE + public static final int MPEG2LevelLL = 0x00; + public static final int MPEG2LevelML = 0x01; + public static final int MPEG2LevelH14 = 0x02; + public static final int MPEG2LevelHL = 0x03; + // from OMX_AUDIO_AACPROFILETYPE public static final int AACObjectMain = 1; public static final int AACObjectLC = 2; diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java index 86c23c7..16b4c43 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java @@ -60,6 +60,7 @@ public class MediaNames { public static final String VIDEO_H264_AAC = "/sdcard/media_api/video/H264_320_AAC_64.3gp"; public static final String VIDEO_H264_AMR = "/sdcard/media_api/video/H264_320_AMRNB_6.3gp"; public static final String VIDEO_HEVC_AAC = "/sdcard/media_api/video/HEVC_320_AAC_128.mp4"; + public static final String VIDEO_MPEG2_AAC = "/sdcard/media_api/video/MPEG2_1500_AAC_128.mp4"; public static final String VIDEO_HIGHRES_H263 = "/sdcard/media_api/video/H263_500_AMRNB_12.3gp"; public static final String VIDEO_HIGHRES_MP4 = "/sdcard/media_api/video/H264_500_AAC_128.3gp"; public static final String VIDEO_WEBM = "/sdcard/media_api/video/big-buck-bunny_trailer.webm"; diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java index 244b07f..c528165 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java @@ -432,7 +432,22 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med assertTrue("HEVC playback memory test", memoryResult); } - // Test case 4: Capture the memory usage after every 20 video only recorded + // Test case 4: Capture the memory usage after every 20 mpeg2 playback + @LargeTest + public void testMPEG2VideoPlaybackMemoryUsage() throws Exception { + boolean memoryResult = false; + + mStartPid = getMediaserverPid(); + for (int i = 0; i < NUM_STRESS_LOOP; i++) { + mediaStressPlayback(MediaNames.VIDEO_MPEG2_AAC); + getMemoryWriteToLog(i); + writeProcmemInfo(); + } + memoryResult = validateMemoryResult(mStartPid, mStartMemory, DECODER_LIMIT); + assertTrue("MPEG2 playback memory test", memoryResult); + } + + // Test case 5: Capture the memory usage after every 20 video only recorded @LargeTest public void testH263RecordVideoOnlyMemoryUsage() throws Exception { if (mCamcorderProfile != null) { @@ -453,7 +468,7 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med } } - // Test case 5: Capture the memory usage after every 20 video only recorded + // Test case 6: Capture the memory usage after every 20 video only recorded @LargeTest public void testMpeg4RecordVideoOnlyMemoryUsage() throws Exception { if (mCamcorderProfile != null) { @@ -474,7 +489,7 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med } } - // Test case 6: Capture the memory usage after every 20 video and audio + // Test case 7: Capture the memory usage after every 20 video and audio // recorded @LargeTest public void testRecordVideoAudioMemoryUsage() throws Exception { @@ -496,7 +511,7 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med } } - // Test case 7: Capture the memory usage after every 20 audio only recorded + // Test case 8: Capture the memory usage after every 20 audio only recorded @LargeTest public void testRecordAudioOnlyMemoryUsage() throws Exception { boolean memoryResult = false; @@ -511,7 +526,7 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med assertTrue("audio record only memory test", memoryResult); } - // Test case 8: Capture the memory usage after every 20 camera preview + // Test case 9: Capture the memory usage after every 20 camera preview @LargeTest public void testCameraPreviewMemoryUsage() throws Exception { boolean memoryResult = false; diff --git a/media/tests/contents/media_api/video/MPEG2_1500_AAC_128.mp4 b/media/tests/contents/media_api/video/MPEG2_1500_AAC_128.mp4 Binary files differnew file mode 100644 index 0000000..33f66a0 --- /dev/null +++ b/media/tests/contents/media_api/video/MPEG2_1500_AAC_128.mp4 |