androidx / androidx/media

rtmp播放中翻转90°后,exoplayer花屏

Open
#920 1 comment 0 reactions 1 assignee View on GitHub

@rohitjoins is already working on this.

Since Dec 31, 2023.

bug needs triage
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Version

ExoPlayer 2.18.6

More version details

rtmp播放中翻转90°后,exoplayer花屏。当rtmp视频翻转90后,视频的宽和高变化,比如之前是640480变成480640,rtmp服务器会再次发送VideoTagHeader信息,在VideoTagPayloadReader.java的parsePayload()方法中hasOutputFormat=true,不会进入if语句中,不会重新创建Format ,导致花屏。目前的处理是把 !hasOutputFormat判断条件去掉就OK了。
代码片段如下:
if (packetType == AVC_PACKET_TYPE_SEQUENCE_HEADER && !hasOutputFormat) {
ParsableByteArray videoSequence = new ParsableByteArray(new byte[data.bytesLeft()]);
data.readBytes(videoSequence.getData(), 0, data.bytesLeft());
AvcConfig avcConfig = AvcConfig.parse(videoSequence);
nalUnitLengthFieldLength = avcConfig.nalUnitLengthFieldLength;
// Construct and output the format.
Format format =
new Format.Builder()
.setSampleMimeType(MimeTypes.VIDEO_H264)
.setCodecs(avcConfig.codecs)
.setWidth(avcConfig.width)
.setHeight(avcConfig.height)
.setPixelWidthHeightRatio(avcConfig.pixelWidthHeightRatio)
.setInitializationData(avcConfig.initializationData)
.build();
output.format(format);
hasOutputFormat = true;
return false;
}

Devices that reproduce the issue

所有设备

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

1.播放rtmp视频
2.旋转90°

Expected result

旋转90°后正常播放。

Actual result

花屏

Media

可进行旋转的rtmp视频

Bug Report
  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.