mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Added release note for change
This commit is contained in:
parent
0ac26c4004
commit
f1654732a6
@ -66,6 +66,9 @@
|
|||||||
`Surface` in `configure` and calls to a new method `detachOutputSurface`
|
`Surface` in `configure` and calls to a new method `detachOutputSurface`
|
||||||
to remove a previously set `Surface` if the codec supports this
|
to remove a previously set `Surface` if the codec supports this
|
||||||
(`MediaCodecInfo.detachedSurfaceSupported`).
|
(`MediaCodecInfo.detachedSurfaceSupported`).
|
||||||
|
* Use `MediaCodecAdapter` supplied pixel aspect ratio values if provided
|
||||||
|
when processing `onOutputFormatChanged`
|
||||||
|
([#1371](https://github.com/androidx/media/pull/1371)).
|
||||||
* Text:
|
* Text:
|
||||||
* Metadata:
|
* Metadata:
|
||||||
* Image:
|
* Image:
|
||||||
|
@ -1342,16 +1342,17 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
? mediaFormat.getInteger(KEY_CROP_BOTTOM) - mediaFormat.getInteger(KEY_CROP_TOP) + 1
|
? mediaFormat.getInteger(KEY_CROP_BOTTOM) - mediaFormat.getInteger(KEY_CROP_TOP) + 1
|
||||||
: mediaFormat.getInteger(MediaFormat.KEY_HEIGHT);
|
: mediaFormat.getInteger(MediaFormat.KEY_HEIGHT);
|
||||||
}
|
}
|
||||||
boolean hasPixelAspectRatio =
|
|
||||||
(Util.SDK_INT >= 30)
|
pixelWidthHeightRatio = format.pixelWidthHeightRatio;
|
||||||
&& mediaFormat != null
|
if (Util.SDK_INT >= 30
|
||||||
&& mediaFormat.containsKey(MediaFormat.KEY_PIXEL_ASPECT_RATIO_WIDTH)
|
&& mediaFormat != null
|
||||||
&& mediaFormat.containsKey(MediaFormat.KEY_PIXEL_ASPECT_RATIO_HEIGHT);
|
&& mediaFormat.containsKey(MediaFormat.KEY_PIXEL_ASPECT_RATIO_WIDTH)
|
||||||
pixelWidthHeightRatio =
|
&& mediaFormat.containsKey(MediaFormat.KEY_PIXEL_ASPECT_RATIO_HEIGHT)) {
|
||||||
hasPixelAspectRatio
|
pixelWidthHeightRatio =
|
||||||
? (float) mediaFormat.getInteger(MediaFormat.KEY_PIXEL_ASPECT_RATIO_WIDTH)
|
(float) mediaFormat.getInteger(MediaFormat.KEY_PIXEL_ASPECT_RATIO_WIDTH)
|
||||||
/ mediaFormat.getInteger(MediaFormat.KEY_PIXEL_ASPECT_RATIO_HEIGHT)
|
/ mediaFormat.getInteger(MediaFormat.KEY_PIXEL_ASPECT_RATIO_HEIGHT);
|
||||||
: format.pixelWidthHeightRatio;
|
}
|
||||||
|
|
||||||
// The decoder applies the rotation when rendering to the surface. For 90 and 270 degree
|
// The decoder applies the rotation when rendering to the surface. For 90 and 270 degree
|
||||||
// rotations, we need to flip the width, height and pixel aspect ratio to reflect the rotation
|
// rotations, we need to flip the width, height and pixel aspect ratio to reflect the rotation
|
||||||
// that was applied.
|
// that was applied.
|
||||||
|
@ -116,6 +116,7 @@ public class MediaCodecVideoRendererTest {
|
|||||||
.setSampleMimeType(MimeTypes.VIDEO_H264)
|
.setSampleMimeType(MimeTypes.VIDEO_H264)
|
||||||
.setWidth(1920)
|
.setWidth(1920)
|
||||||
.setHeight(1080)
|
.setHeight(1080)
|
||||||
|
.setPixelWidthHeightRatio(1.0f)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
private static final TrackGroup TRACK_GROUP_H264 = new TrackGroup(VIDEO_H264);
|
private static final TrackGroup TRACK_GROUP_H264 = new TrackGroup(VIDEO_H264);
|
||||||
@ -762,12 +763,9 @@ public class MediaCodecVideoRendererTest {
|
|||||||
public MediaFormat getOutputFormat() {
|
public MediaFormat getOutputFormat() {
|
||||||
MediaFormat mediaFormat = adapter.getOutputFormat();
|
MediaFormat mediaFormat = adapter.getOutputFormat();
|
||||||
if (Util.SDK_INT >= 30) {
|
if (Util.SDK_INT >= 30) {
|
||||||
int pixelAspectRatioHeight = 1 << 30; // Max integer power of 2.
|
// Change to 9:16 Ratio
|
||||||
int pixelAspectRatioWidth = (int) (0.5f * pixelAspectRatioHeight);
|
mediaFormat.setInteger(MediaFormat.KEY_PIXEL_ASPECT_RATIO_WIDTH, 9);
|
||||||
mediaFormat.setInteger(
|
mediaFormat.setInteger(MediaFormat.KEY_PIXEL_ASPECT_RATIO_HEIGHT, 16);
|
||||||
MediaFormat.KEY_PIXEL_ASPECT_RATIO_WIDTH, pixelAspectRatioWidth);
|
|
||||||
mediaFormat.setInteger(
|
|
||||||
MediaFormat.KEY_PIXEL_ASPECT_RATIO_HEIGHT, pixelAspectRatioHeight);
|
|
||||||
}
|
}
|
||||||
return mediaFormat;
|
return mediaFormat;
|
||||||
}
|
}
|
||||||
@ -825,7 +823,9 @@ public class MediaCodecVideoRendererTest {
|
|||||||
verify(eventListener)
|
verify(eventListener)
|
||||||
.onVideoSizeChanged(
|
.onVideoSizeChanged(
|
||||||
new VideoSize(
|
new VideoSize(
|
||||||
VIDEO_H264.width, VIDEO_H264.height, VIDEO_H264.pixelWidthHeightRatio / 2));
|
VIDEO_H264.width,
|
||||||
|
VIDEO_H264.height,
|
||||||
|
/* pixelWidthHeightRatio= */ VIDEO_H264.pixelWidthHeightRatio * (9.0f / 16.0f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user