0

I have RK3288 Hardware Board and I am trying to use software decoder on it.. I have already integrated my software decoder with the android stage-fright player.. It is perfectly integrated and video is also running completely..

But now the problem is when I pause or seek video ,pop up window says

"Can't Play this video"

When I click on pause button it again calls awesomeplayer's constructor(I checked this out with the printf).

So please Can anybody point where i am missing in my code? or is there any other changes required?

My Onqueuefilled Function(which is similar to SoftAVC.cpp)

   void IntdecHEVC::onQueueFilled(OMX_U32 portIndex) {
        UNUSED(portIndex);
            if (checkp) {                          
            return;
        }

        IAccessUnit pic_val;
        DisplayPic Display_val;
        int32_t got_frame;
        int32_t timeDelay, timeTaken;
        unsigned int p;    
        if (mSignalledError) {
            return;
        }
        if (mOutputPortSettingsChange != NONE) {
            return;
        }


        List<BufferInfo *> &inQueue = getPortQueue(kInputPortIndex);
        List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);

             while (!outQueue.empty()) {
            BufferInfo *inInfo;
            OMX_BUFFERHEADERTYPE *inHeader = NULL;

        BufferInfo *outInfo;
            OMX_BUFFERHEADERTYPE *outHeader = NULL;
            uint8_t *pBuf;

            inInfo = NULL;
            inHeader = NULL;
            Display_val.eosFlag = false;

            if (!mIsInFlush) {
                    if (!inQueue.empty()) {
                    inInfo = *inQueue.begin();
                    inHeader = inInfo->mHeader;

                } else {
                    break;
                }
            }


        outInfo = *outQueue.begin();
                outHeader = outInfo->mHeader;
                outHeader->nFlags = 0;
                outHeader->nTimeStamp = 0;
                outHeader->nOffset = 0;


        if (inHeader != NULL && (inHeader->nFlags & OMX_BUFFERFLAG_EOS)) {

                mReceivedEOS = true;
                Display_val.eosFlag = true;
                if (inHeader->nFilledLen == 0) {

                    inQueue.erase(inQueue.begin());
                    inInfo->mOwnedByUs = false;
                    notifyEmptyBufferDone(inHeader);
                    inHeader = NULL;
                    setFlushMode();        
                }
            }    

            if (inHeader != NULL) {

                pic_val.bufferData = inHeader->pBuffer + inHeader->nOffset;
                pic_val.bufferLength = inHeader->nFilledLen;
                pic_val.pts = inHeader->nTimeStamp;

            }

       if (outHeader) 
                pBuf = outHeader->pBuffer;

                Display_val.pobLumaSl  = pBuf;
                Display_val.pobCromaCb = pBuf + (mWidth * mHeight);
                Display_val.pobCromaCr = //pBuf + (mWidth*mHeight) + (m_lOriginalWidthUV*m_lHeightUV);

                Display_val.pobCromaCb +(m_lOriginalWidthUV*m_lHeightUV);


            GETTIME(&mTimeStart, NULL);
            /* Compute time elapsed between end of previous decode()
             * to start of current decode() */
            TIME_DIFF(mTimeEnd, mTimeStart, timeDelay);



            // set the height and width of the picture */
            pic_val.width = mWidth;
            pic_val.height = mHeight;

           mInterface.api_inte265Decode(&pic_val); //decoding data

    handlePortSettingChangeEvent(&pic_val);                  
            GETTIME(&mTimeEnd, NULL);
            /* Compute time taken for decode() */
            TIME_DIFF(mTimeStart, mTimeEnd, timeTaken);
                  got_frame = mInterface.api_inte265GetPic(&Display_val);

    if (got_frame) {

                FormatIYUV(&Display_val);       //copy data to outputbuffer 1-4


                    /* added to check decoded data by pooja*/
                    if (1) {

                        unsigned int i;
                        unsigned int MAX_SIZE = Display_val.width * Display_val.height;

                        for (i = 0; i < MAX_SIZE; i++) {
                            fwrite(&Display_val.pobLumaSl[i], sizeof(uint8_t), 1, fb);
                        }

                        MAX_SIZE = (Display_val.width >> 1) * (Display_val.height >> 1);

                        for (i = 0; i < MAX_SIZE; i++) {
                            fwrite(&Display_val.pobCromaCb[i], sizeof(uint8_t), 1, fb);
                        }

                        for (i = 0; i < MAX_SIZE; i++) {
                            fwrite(&Display_val.pobCromaCr[i], sizeof(uint8_t), 1, fb);
                        }

                    }

                    if (outHeader != NULL) {

                        outHeader->nFilledLen = (Display_val.width * Display_val.height * 3) / 2;

                        outHeader->nTimeStamp = Display_val.pts;

                        outInfo->mOwnedByUs = false;
                        outQueue.erase(outQueue.begin());
                        outInfo = NULL;
                        notifyFillBufferDone(outHeader);
                        outHeader = NULL;
                    }
                } else if (mIsInFlush) {

                    /* If in flush mode and no output is returned by the codec,
                     * then come out of flush mode */
                    mIsInFlush = false;

                    /* If EOS was recieved on input port and there is no output
                     * from the codec, then signal EOS on output port */
                    if (mReceivedEOS) {

                        if (outHeader != NULL) {

                            outHeader->nFilledLen = 0;
                            outHeader->nFlags |= OMX_BUFFERFLAG_EOS;              // 12-4-2016                            
                            outInfo->mOwnedByUs = false;
                            outQueue.erase(outQueue.begin());
                            outInfo = NULL;
                            notifyFillBufferDone(outHeader);
                            outHeader = NULL;
                            resetPlugin();
                resetDecoder();     // added 
                checkp = true;               //15-4-2016
               // break;                        //13-4-2016
                return;                     //14-4-2016
                        }
           }
                  }


    /* If input EOS is seen and decoder is not in flush mode,
         * set the decoder in flush mode.
         * There can be a case where EOS is sent along with last picture data
         * In that case, only after decoding that input data, decoder has to be
         * put in flush. This case is handled here  */

        if (mReceivedEOS && !mIsInFlush) {

                 setFlushMode();
              }


            /* Notify to client that empty buffer is done - pooja*/
            if (inHeader != NULL) {
                //inHeader->nFilledLen = 0;

                inInfo->mOwnedByUs = false;
                inQueue.erase(inQueue.begin());
                inInfo = NULL;
                notifyEmptyBufferDone(inHeader);
                inHeader = NULL;
            }



        }       // end !outQueue.empty()) loop


    }
Pooja
  • 1
  • 1
  • A couple of queries: Is this behavior observed with all video files or a specific video file? Does the same video work fine with the default `HEVC` player? If you can connect `adb`, can you share the `logcat` from `ACodec` and `MediaCodec` ? Atleast default logs would show some error. This could give us some clues on what could be going wrong. – Ganesh Apr 26 '16 at 23:50
  • Can you tell me,what happens after pause event?? which functions should i target??? Any implementation is needed in Software decoder component??? – Pooja May 04 '16 at 06:20
  • When `pause` is called, the `sink` is paused. The entire framework works in a *pull* model i.e. when `sink` stops pulling data, rest of the pipeline gets automatically choked. I am not too conversant with the last release and hence, I am not sure if any additional changes have been introduced as part of `pause`. Ideally your component should run out of `output` buffers and should automatically choke. Please check how you are implementing `EmptyThisBuffer` when an output buffer is not present.. – Ganesh May 04 '16 at 06:41
  • Thank you...I have implemented my custom codec (IntdecHEVC.cpp) as [link] (https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/codecs/hevcdec/SoftHEVC.cpp ) ...and I am playing video without sound but still when i pause soundpool.cpp file is getting invoked...why??? – Pooja Jun 25 '16 at 11:33
  • and that soundpool.cpp function is ultimately creating new player and awesomeplayer.cpp constructor is getting called...any solution for this???? – Pooja Jun 25 '16 at 11:37
  • `SoundPool` is mainly employed to load pre-determined sounds in the platform. You can have a look here for more detailed information: https://developer.android.com/reference/android/media/SoundPool.html . If you really want to avoid it, goto `settings`--> `sound` and __mute__ the platform. Maybe that will help you to tide over the `SoundPool` creation. My guess is that the same is being created to handle the button, touch notifications etc. – Ganesh Jun 25 '16 at 17:07
  • Thank you..Now when I turn off touch sound in board setting then pause works fine and when I turn on that setting then there is problem..Can you tell me any permanent solution for this problem???? – Pooja Jul 04 '16 at 11:31
  • I can help only if we have the complete `logcat` for the platform when this issue happens. If you can share the same, I could provide some perspectives about the same. – Ganesh Jul 07 '16 at 15:25

0 Answers0