Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-stagefright-plugins: Commit

external/stagefright-plugins


Commit MetaInfo

Revisionf6c1728817236c40d54dccb302145e43636380dd (tree)
Time2020-11-20 00:57:21
AuthorMichael Goffioul <michael.goffioul@gmai...>
CommiterChih-Wei Huang

Log Message

Fix AVC profiles and codec size limit

While investigating while ExoPlayer wouldn't choose ffmpeg codec for
1080p/h264 (and fallback to google's codec), I found out that ACodec.cpp
has a hard-coded limit of 32 when enumerating supported AVC profile
levels from the codec. Because the ffmpeg omx declares all supported
levels, this goes beyond the hard limit and the list presented at the
app level is truncated. By comparison, SoftAVCDec.cpp only declares
the highest supported level for each profile.

Also, the size limit declared in the codec XML definition file is set
to 2048x2048 for h264 and hevc, which means ExoPlayer wouldn't select
the codec for UHD and above.

The patch solves the 2 issues.

Change Summary

Incremental Difference

--- a/data/media_codecs_ffmpeg.xml
+++ b/data/media_codecs_ffmpeg.xml
@@ -96,12 +96,12 @@
9696 <Feature name="adaptive-playback" />
9797 </MediaCodec>
9898 <MediaCodec name="OMX.ffmpeg.h264.decoder" type="video/avc">
99- <Limit name="size" min="2x2" max="2048x2048" />
99+ <Limit name="size" min="2x2" max="4080x4080" />
100100 <Limit name="alignment" value="2x2" />
101101 <Feature name="adaptive-playback" />
102102 </MediaCodec>
103103 <MediaCodec name="OMX.ffmpeg.hevc.decoder" type="video/hevc">
104- <Limit name="size" min="2x2" max="2048x2048" />
104+ <Limit name="size" min="2x2" max="4096x4096" />
105105 <Limit name="alignment" value="2x2" />
106106 <Feature name="adaptive-playback" />
107107 </MediaCodec>
--- a/omx/SoftFFmpegVideo.cpp
+++ b/omx/SoftFFmpegVideo.cpp
@@ -42,58 +42,9 @@ static const CodecProfileLevel kM4VProfileLevels[] = {
4242 };
4343
4444 static const CodecProfileLevel kAVCProfileLevels[] = {
45- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel1 },
46- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel1b },
47- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel11 },
48- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel12 },
49- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel13 },
50- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel2 },
51- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel21 },
52- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel22 },
53- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel3 },
54- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel31 },
55- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel32 },
56- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel4 },
57- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel41 },
58- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel42 },
59- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel5 },
60- { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel51 },
45+ // Only declare the highest level for each supported profile
6146 { OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel52 },
62-
63- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel1 },
64- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel1b },
65- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel11 },
66- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel12 },
67- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel13 },
68- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel2 },
69- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel21 },
70- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel22 },
71- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel3 },
72- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel31 },
73- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel32 },
74- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel4 },
75- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel41 },
76- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel42 },
77- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel5 },
78- { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel51 },
7947 { OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel52 },
80-
81- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel1 },
82- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel1b },
83- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel11 },
84- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel12 },
85- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel13 },
86- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel2 },
87- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel21 },
88- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel22 },
89- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel3 },
90- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel31 },
91- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel32 },
92- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel4 },
93- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel41 },
94- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel42 },
95- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel5 },
96- { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel51 },
9748 { OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel52 },
9849 };
9950
Show on old repository browser