2016-11-22 98 views
0

我的问题非常清楚。编解码器运行时是否可以配置媒体编解码器?动态配置mediaCodec

代码示例:

codec = MediaCodec.createDecoderByType("video/avc"); 
    MediaFormat format = MediaFormat.createVideoFormat(CodecConfigurations.MIME_TYPE, 
      CodecConfigurations.WIDTH, CodecConfigurations.HEIGHT); 
    Log.d(LOG_TAG, "Track Format: " + mime); 
    format.setInteger(MediaFormat.KEY_BIT_RATE, 125000); 
    format.setInteger(MediaFormat.KEY_FRAME_RATE, 15); 
    format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Planar); 
    format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 5); 
    codec.configure(format, null, null, 0); 
    codec.start(); 

是否有可能以如下重新编解码器不停止编解码器?

format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 10); 
codec.configure(format, null, null, 0); 

回答

0

按照documentation ...

enter image description here

这样看来,你可能只能从初始化状态配置编解码器,要求你停止/复位运行的编解码器这样做。