Note that there are some explanatory texts on larger screens.

plurals
  1. PODecoding H264 streaming using android low level api
    primarykey
    data
    text
    <p>I am using MediaCodec low level Api in android to decode h264 raw stream received from IP CAMERA. Raw stream from IP camera , receiving on TCP/IP connection.</p> <p>To decode stream , My code is :</p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { MediaCodec mCodecc; MediaFormat mFormat; BufferInfo mInfo; ByteBuffer[] inputBuffers ; ByteBuffer[] outputBuffers ; } protected void Init_Codec() { mCodecc = MediaCodec.createDecoderByType("video/avc"); mFormat = MediaFormat.createVideoFormat("video/avc", width, height); mInfo = new BufferInfo(); mFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT,MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Planar); mCodecc.configure(mFormat, holder.getSurface(), null,0); } protected void Start_Codec() { mCodecc.start(); inputBuffers = mCodecc.getInputBuffers(); outputBuffers = mCodecc.getOutputBuffers(); } private void OnRawStreamReceived(final ByteBuffer buffer) { mHandler.postAtFrontOfQueue(new Runnable() { @Override public void run() { int inIndex = mCodecc.dequeueInputBuffer(10000); if(inIndex&gt;=0) { inputBuffers[inIndex] = buffer; mCodecc.queueInputBuffer(inIndex, 0,buffer.limit(),System.currentTimeMillis(), 0); } int outIndex = mCodecc.dequeueOutputBuffer(mInfo, 10000); switch (outIndex) { case MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED: Log.d("DecodeActivity", "INFO_OUTPUT_BUFFERS_CHANGED"); outputBuffers = mCodecc.getOutputBuffers(); break; case MediaCodec.INFO_OUTPUT_FORMAT_CHANGED: Log.d("DecodeActivity", "New format " + mCodecc.getOutputFormat()); break; case MediaCodec.INFO_TRY_AGAIN_LATER: Log.d("DecodeActivity", "dequeueOutputBuffer timed out! --- size : " + mInfo.size ); break; default: ByteBuffer buffer = outputBuffers[outIndex]; mCodecc.releaseOutputBuffer(outIndex, true); break; } } int outIndex = mCodecc.dequeueOutputBuffer(mInfo, 10000); </code></pre> <p>But at this line of code , I'm always receiving "-1". and mInfo.size() is also I'm getting "0". and It is not displaying anything on given surface.</p> <p>Which step I'm missing. please guide me. thanx</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload