Skip to content

Commit ea775af

Browse files
committed
commit
1 parent 2dbe2f1 commit ea775af

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

app/src/main/java/com/demo/mediacodec/decode/DecodePlayActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ public void run() {
216216
if (TextUtils.isEmpty(codecName)) {
217217
log.append("prepareDecoder: 移除profile、level后format没有找到解码器!:").append(mVideoFormat).append("\n");
218218
if (maybeSwitchWH) {
219-
//Oppo有某些SB的设备,竖屏拍摄的视频,不写rotation到metadata中去,导致这里因为解码器的宽高限制,无法获取到解码器.
219+
//Oppo有某些设备,竖屏拍摄的视频,不写rotation到metadata中,而是直接交换宽高(一般竖屏视频是1920x1080+90度,而这些特殊视频是1080x1920+0),
220+
//导致这里因为解码器的宽高限制,无法获取到解码器.
220221
log.append("prepareDecoder: 尝试交换Width和Height\n");
221222
MediaFormat simpleFormat = MediaFormat.createVideoFormat(mime, height, width);
222223
codecName = MediaCodecUtils.findDecoderByFormat(simpleFormat);

app/src/main/java/com/demo/mediacodec/transcode/TranscodeRunner.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@ private void prepareDecoder(VideoOutputConfig outputConfig) throws Exception {
402402

403403
if (TextUtils.isEmpty(codecName)) {
404404
if (mMaybeSwitchWH) {
405-
//Oppo有某些SB的设备,竖屏拍摄的视频,不写rotation到metadata中去,导致这里因为解码器的宽高限制,无法获取到解码器.
405+
//Oppo有某些设备,竖屏拍摄的视频,不写rotation到metadata中,而是直接交换宽高(一般竖屏视频是1920x1080+90度,而这些特殊视频是1080x1920+0),
406+
//导致这里因为解码器的宽高限制,无法获取到解码器.
406407
MediaFormat simpleFormat = MediaFormat.createVideoFormat(mOriVideoMime, mOriVideoHeight, mOriVideoWidth);
407408
codecName = MediaCodecUtils.findDecoderByFormat(simpleFormat);
408409
}

0 commit comments

Comments
 (0)