MediaCodec storeMetaDataInBuffers应用自己分配buffer设给编码器


https://stackoverflow.com/questions/31899396/mediacodec-is-giving-a-storemetadatainbuffers-trace-error



MediaCodec is giving a storeMetaDataInBuffers trace error

Ask Question
up vote 4 down vote favorite

I'm getting on the logcat the next error while encoding via the MediaCodec in Android.

The actual encoding works fine and the output is produced correctly, so I can't really understand why I get this trace. Is it a harmless error trace, or is there something I'm missing?

E/ACodec(6438): [OMX.qcom.video.encoder.h263] storeMetaDataInBuffers (output) failed w/ err -1010

Next is the code where I get the trace

final int BIT_RATE          = 4000000;
final int FRAME_RATE        = 30;
final int IFRAME_INTERVAL   = 5;
final String MIME_TYPE      = "video/avc";

final MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, width, height);
format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
format.setInteger(MediaFormat.KEY_BIT_RATE, BIT_RATE);
format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE);
format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, IFRAME_INTERVAL);

MediaCodec encoder = MediaCodec.createEncoderByType(MIME_TYPE);

//---------------------------------
// NEXT LINE PRODUCES THE TRACE
encoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
//---------------------------------
share improve this question
 

2 Answers

active oldest votes
up vote 2 down vote accepted

It's harmless, most devices show this. See Q12 at http://bigflake.com/mediacodec/.

This only tells that the first way of signaling surface encoding wasn't supported by the encoder, so it used some other ways of setting it up. (There are multiple ways for the MediaCodec/ACodec layer to tell the individual encoder about it.)

share improve this answer
 
up vote 2 down vote

The previous answer has indicated that the warning is quite harmless. Some additional information on the log and reasons behind the same

This trace in the log is indicating that the encoder is not supporting storeMetadataInBuffers on the output port. For an encoder, this mode could be supported on both input and output ports.

This mode is employed for input port to pass raw image data in metadata format i.e. pass only a reference to the gralloc handle which can employed by the encoder to access the data. This is employed by the camera and/or other screen recording applications to pass a reference to YUVdata to the encoder.

The metadata mode was supported for output port also for potential encapsulation of output bitstream data. For example, when a Miracast or WiFi-Display session is active and the data being encoded is secure like a premium content, it becomes necessary to protect data between the encoder and HDCP encryption module, during which metadata format becomes handy. Not many encoders support this mode and hence, you observe this warning.

share improve this answer
 
 
Then is there any configuration flag that can be set to avoid this trace, or is the trace just informative? –  PerracoLabs  Aug 9 '15 at 12:16
1  
@PerracoLabs.. It's just informative as it's part of the Stagefright framework. I think it can easily be ignored. Please note that the same print works for both input and output ports. Encoders should support this mode on input port for optimal usage. –  Ganesh  Aug 9 '15 at 12:22

你可能感兴趣的:(Android,MultiMedia)