Evaluating bids

Support ogengl

Published on the August 17, 2020 in IT & Programming

About this project

Open

I am trying to decode/encode/mux adudio and video based on https://android.googlesource.com/platform/cts/+/jb-mr2-release/tests/tests/media/src/android/media/cts/ExtractDecodeEditEncodeMuxTest.java.

I converted the code to c# because I am developing the program in Xamarin for Android and iOs

I am able to get the video track but the audio track does not encode correctly. The audio track is from the original video.

In this lines of code, I get an encoder buffer of big size (3133xxx) and when I try to put de buffer in the encoderInputBuffer I get a bufferOverFlow. In the debugger I see the size of audioDecoderOutputBufferInfo = 3133440 and the encoderInputBuffer has a size of 4096.

Seems like the decoder is doing once for the whole audio track and it is huge.
                    
                    ByteBuffer encoderInputBuffer = audioEncoderInputBuffers[encoderInputBufferIndex];
                    int size = audioDecoderOutputBufferInfo.Size;
                    long presentationTime = audioDecoderOutputBufferInfo.PresentationTimeUs;
                    if (Constants.VERBOSE)
                    {
                        Console.WriteLine("audio decoder: processing pending buffer: "
                                + pendingAudioDecoderOutputBufferIndex);
                    }
                    if (Constants.VERBOSE)
                    {
                        System.Console.WriteLine("audio decoder: pending buffer of size " + size);
                        System.Console.WriteLine("audio decoder: pending buffer for time " + presentationTime);
                    }
                    if (size >= 0)
                    {
                        ByteBuffer decoderOutputBuffer =
                            audioDecoderOutputBuffers[pendingAudioDecoderOutputBufferIndex].Duplicate();
                        decoderOutputBuffer.Position(audioDecoderOutputBufferInfo.Offset);
                        decoderOutputBuffer.Limit(audioDecoderOutputBufferInfo.Offset + size);
                        encoderInputBuffer.Position(0);
                        encoderInputBuffer.Put(decoderOutputBuffer);
                        audioEncoder.QueueInputBuffer(
                                encoderInputBufferIndex,
                                0,
                                size,
                                presentationTime,
                                audioDecoderOutputBufferInfo.Flags);
                    }

Category IT & Programming
Subcategory Apps programming. Android, iOS and others

Delivery term: Not specified

Skills needed