locked
about the playback of the avi media file RRS feed

  • Question

  • I am coding a directshow-based h.264 decoder. I connect my decoder to the haali media splitter to play media files with h.264 contents. Most are fine. But avi files are not. When I render a avi file in graphedit, it connected to my decoder by the haali media splitter, but when I play it, the graphedit crashed.
    I wrote some test code to locate the error and found the following function never run.
    HRESULT CMyAVC::Transform(IMediaSample *pIn, IMediaSample *pOut)
    {
    bool retstatus = S_OK, isPure264 = 0;
        CheckPointer(pIn,E_POINTER);  
        CheckPointer(pOut,E_POINTER);  
        if(handle == 0)
            return S_FALSE;
        if(pIn->IsDiscontinuity() == S_OK)
        {
            ll_flush_h264decoder(handle);
            pOut->SetDiscontinuity(S_OK);
        }

        u_int8 *pBitstrm;
        s_int32 totLength;
        pIn->GetPointer(&pBitstrm);

        totLength = pIn->GetActualDataLength();
        if(((u_int32*)pBitstrm)[0] == 0x01000000)
            isPure264 = 1;

    while (totLength > 0)
        {
            u_int32 cur_len = (pBitstrm[0]<<24)+(pBitstrm[1]<<16)+(pBitstrm[2]<<8)+pBitstrm[3];
            if(!isPure264) ((u_int32*)pBitstrm)[0] = 0x01000000;

            bitStrm.bs_length = cur_len+4;
            if(isPure264)
                bitStrm.bs_length = totLength;
            else if((u_int32)(bitStrm.bs_length) > totLength)
                break;

            //the input buffer must include one slice at least
            s_int32 status = ll_dec_h264decoder(handle, &bitStrm);
    }
    }

    Where does the crash occur?
    Wednesday, September 23, 2009 8:55 PM

Answers

  • See my FAQs page for information on how to run your filter in the debugger to find out where the crash is.
    Please use Vote As Helpful (green up arrow at top-left of posts) and Mark As Answer where appropriate.
    My dshow site is http://tmhare.mvps.org.
    • Marked as answer by The March Hare Tuesday, October 13, 2009 11:48 PM
    Thursday, September 24, 2009 3:12 PM
  • The crash is from my lib. When the avi file is played and when the first sample is received from the upstream,  the pIn->IsDiscontinuity() is set as S_OK, then the ll_flush_h264decoder(handle) is called.
    But in my lib, the ll_flush_h264decoder is only valid when the video is playing and at least one sample has been fed to the decoder.
    • Marked as answer by The March Hare Tuesday, October 13, 2009 11:48 PM
    Sunday, October 4, 2009 6:52 PM

All replies

  • See my FAQs page for information on how to run your filter in the debugger to find out where the crash is.
    Please use Vote As Helpful (green up arrow at top-left of posts) and Mark As Answer where appropriate.
    My dshow site is http://tmhare.mvps.org.
    • Marked as answer by The March Hare Tuesday, October 13, 2009 11:48 PM
    Thursday, September 24, 2009 3:12 PM
  • See my FAQs page for information on how to run your filter in the debugger to find out where the crash is.
    Please use Vote As Helpful (green up arrow at top-left of posts) and Mark As Answer where appropriate.
    My dshow site is
    http://tmhare.mvps.org.

    Did this help solve your issue?   I see you have three new questions on your decoder.

    Please use Vote As Helpful (green up arrow at top-left of posts) and Mark As Answer where appropriate.
    My dshow site is http://tmhare.mvps.org.
    Saturday, October 3, 2009 2:58 AM
  • I solve the problem myself.
    Saturday, October 3, 2009 6:29 AM
  • It's useful to follow up with your solution when you solve a problem.  There is a search feature where people can find solutions to problems without having to post a new question.

    You solved it without using the debugger?  How?

    Please use Vote As Helpful (green up arrow at top-left of posts) and Mark As Answer where appropriate.
    My dshow site is http://tmhare.mvps.org.
    Saturday, October 3, 2009 5:49 PM
  • The crash is from my lib. When the avi file is played and when the first sample is received from the upstream,  the pIn->IsDiscontinuity() is set as S_OK, then the ll_flush_h264decoder(handle) is called.
    But in my lib, the ll_flush_h264decoder is only valid when the video is playing and at least one sample has been fed to the decoder.
    • Marked as answer by The March Hare Tuesday, October 13, 2009 11:48 PM
    Sunday, October 4, 2009 6:52 PM