0

Now, I am developing our own Android Auto Project. I encountered an issue. I added 3 supported VideoConfiguration. (1920 X 1080, 1280 X 720, 800 X 480) Our in-car screen's size is 1920 X 720. After I started my app in car, I noticed the cellphone informed us which the video output from the cellphone(or MD) was 1920 X 1080. I also set the view area as 1920 X 720, or in another way, the content area was 1920 X 720. Finally, the projectional video was shown, but unfortunately, the video was stretched forcefully. All of those icons, texts were out of shape, as if my configuration was useless. My question is, how can I adjust my parameters so that the projectional contents from MD can be shown properly.

I asked google's service desk, they told me to set the margin on top and bottom 180 respectively. But I tried, as below,

    VideoFrameRateType frameRate = (fps == 30) ? VideoFrameRateType.VIDEO_FPS_30 : VideoFrameRateType.VIDEO_FPS_60;
    Protos.Insets.Builder insetsBuilder = Protos.Insets.newBuilder().setTop(180).setBottom(180);
    UiConfig.Builder uiBuilder = UiConfig.newBuilder().setMargins(insetsBuilder);


    VideoConfiguration.Builder builder = VideoConfiguration.newBuilder()

// .setUiConfig(uiBuilder) .setCodecResolution(codecResolution) .setFrameRate(frameRate) .setWidthMargin(0) .setHeightMargin(360) .setDensity(213) .setRealDensity(170) .setVideoCodecType(MediaCodecType.MEDIA_CODEC_VIDEO_H264_BP) .setDecoderAdditionalDepth(decoderAdditionalDepth) .setViewingDistance(viewingDistance) .setPixelAspectRatioE4(Math.round(pixelAspectRatio * 1e4f));

I tried to set heightMargin, or add UiConfig's setTop(180).setBottom(180), nothing could sort the problem out.

Or, is there anything I can do we I create MediaFormat format = MediaFormat.createVideoFormat programmatically?

Briks Wang
  • 11
  • 1

1 Answers1

1

I think I have already wrapped things up by myself. First, we need to adjust our layout attributes, from match_parent to 1920px & 1080px.

Second, before we create a VedioConfiguration, we should new UiConfig and set its top & bottom to match your content area.

Briks Wang
  • 11
  • 1
  • 1
    Hi, We tried your approach both layout adjustment and updating UiConfig with margins and this didn't help us. We facing same issue. Is it possible to elaborate more on your solution and if you provide code snippet will be great. – Manukumar Jan 07 '22 at 12:15