0

我使用的是 1.0.28513 版本,但不确定如何/在何处将 VP8 指定为我的视频编解码器以进行硬件加速。

4

1 回答 1

0

再见,

看看Kotlin中这个精彩的例子:

private val peerConnectionFactory: PeerConnectionFactory by lazy {
    //Initialize PeerConnectionFactory globals.
    val initializationOptions = PeerConnectionFactory.InitializationOptions.builder(this)
            .setEnableVideoHwAcceleration(true)
            .createInitializationOptions()
    PeerConnectionFactory.initialize(initializationOptions)

    //Create a new PeerConnectionFactory instance - using Hardware encoder and decoder.
    val options = PeerConnectionFactory.Options()
    val defaultVideoEncoderFactory = DefaultVideoEncoderFactory(
            rootEglBase.eglBaseContext, /* enableIntelVp8Encoder */true, /* enableH264HighProfile */true)
    val defaultVideoDecoderFactory = DefaultVideoDecoderFactory(rootEglBase.eglBaseContext)
    PeerConnectionFactory(options, defaultVideoEncoderFactory, defaultVideoDecoderFactory)
}

以及对应的Java 类

/** Create encoder factory using default hardware encoder factory. */
public DefaultVideoEncoderFactory(
    EglBase.Context eglContext, boolean enableIntelVp8Encoder, boolean enableH264HighProfile) {
  this.hardwareVideoEncoderFactory =
        new HardwareVideoEncoderFactory(eglContext, enableIntelVp8Encoder, enableH264HighProfile);
}

/** Create encoder factory using explicit hardware encoder factory. */
DefaultVideoEncoderFactory(VideoEncoderFactory hardwareVideoEncoderFactory) {
    this.hardwareVideoEncoderFactory = hardwareVideoEncoderFactory;
}

应该可以帮助您确定在哪里采取行动

希望能帮助到你

祝你有美好的一天,
安东尼诺

于 2019-11-09T03:37:52.943 回答