Skip to content

Fix AVC encoder selection on some MTK devices: try non-secure encoders before *.secure #2057

@anilateapp

Description

@anilateapp

Describe the bug
On some MediaTek/Transsion devices, H.264 encoder selection may pick a secure encoder first
(for example c2.mtk.avc.encoder.secure).

That encoder appears to be intended for DRM / protected-content pipelines. With a normal
camera + Surface/GL streaming path, it may configure successfully but produce no usable
video output.

In practice, RTMP sends audio only:

  • audio packets are written
  • no SPS/PPS callback for video
  • no encoded video output
  • no video packets written

After moving secure video encoders to the end of the candidate list, the device selects
a normal AVC encoder and streaming works correctly.

To Reproduce

  1. Run streaming on an affected MediaTek/Transsion device
  2. Start an RTMP stream using H.264 video
  3. Let the library select the default video encoder
  4. Observe that c2.mtk.avc.encoder.secure is selected
  5. Observe that audio is sent but video is not

Expected behavior
A normal non-secure AVC encoder should be selected first when available, so camera streaming
produces normal H.264 video output and RTMP sends both audio and video.

Screenshots
N/A

Smartphone (please complete the following information):

  • Library version: 2.7.1
  • Device: [your Transsion device model here]
  • OS: [your Android version here]
  • Media server: [your RTMP server here]
  • Class used: GenericStream

Additional context
I verified this against a working Qualcomm device, where a normal non-secure AVC encoder is selected
and both audio/video are sent correctly.

On the affected MTK device, selecting a non-secure encoder fixes the issue.

Local fix:

  • move secure video encoders after normal candidates in VideoEncoder
  • deprioritize secure video encoders in CodecUtil

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions