Segfault sending more than 1 frame

Do you have questions about Desktop Video, Converters, Routers and Monitoring?
  • Author
  • Message
Offline

Tyler Willey

  • Posts: 2
  • Joined: Thu Sep 04, 2014 7:57 pm

Segfault sending more than 1 frame

PostThu Sep 04, 2014 8:16 pm

I can startup the decklink interface and enable the video output.

I can even create a frame and send that frame.

But the second frame I create, after calling GetBytes, dereferencing the pointer to assign frame data causes a seg fault.

Maybe I'm missing something in initialization?

This only happens on modes 2+... Mode 0/1 work ok.

Whether the second frame comes in preroll, or is scheduled in ScheduledFrameCompleted. (before or after a call to StartScheduledPlayback)

A simplified version of what I'm executing:

Code: Select all
    IDeckLinkIterator *deckLinkIterator = CreateDeckLinkIteratorInstance();
    IDeckLink *deckLink;
    IDeckLinkOutput *deckLinkOutput;

   deckLinkIterator = CreateDeckLinkIteratorInstance();
    deckLinkIterator->Next(&deckLink);
   deckLink->QueryInterface(IID_IDeckLinkOutput, (void**)&deckLinkOutput);
    deckLinkOutput->SetScheduledFrameCompletionCallback(sender);

    IDeckLinkDisplayModeIterator *modes;
    IDeckLinkDisplayMode *mode;

   int i = 0;

    deckLinkOutput->GetDisplayModeIterator(&modes);
    while (modes->Next(&mode) == S_OK)
    {
        if (i++ == 2)
        {
            modes->Release();
            break;
        }
    }

    int destWidth, destHeight, frameNum = 0;
    BMDTimeValue frameDur;
    BMDTimeScale timescale;

   mode->GetFrameRate(&frameDur, &timescale);
    destWidth = mode->GetWidth();
    destHeight = mode->GetHeight();

   deckLinkOutput->EnableVideoOutput(mode->GetDisplayMode(), bmdVideoOutputVANC);
   
    IDeckLinkMutableVideoFrame *nextFrame = NULL;
    deckLinkOutput->CreateVideoFrame(destWidth, destHeight, ((destWidth + 47) / 48) * 128, bmdFormat10BitYUV, bmdFrameFlagDefault, &nextFrame);
   
    int bytes = (destHeight * (((destWidth + 47) / 48) * 128));
    uint32_t *word = NULL;
   
    nextFrame->GetBytes((void**)&word);

    while(bytes > 0)
    {
        *(word++) = 0x40aa298;
        *(word++) = 0x2a8a62a8;
        *(word++) = 0x298aa040;
        *(word++) = 0x2a8102a8;
        bytes -= 4;
    }

    ult = deckLinkOutput->ScheduleVideoFrame(nextFrame, frameNum * frameDur, frameDur, timescale);   
    nextFrame->Release();

    frameNum++;
    nextFrame = NULL;

    deckLinkOutput->CreateVideoFrame(destWidth, destHeight, ((destWidth + 47) / 48) * 128, bmdFormat10BitYUV, bmdFrameFlagDefault, &nextFrame);
   
    bytes = (destHeight * (((destWidth + 47) / 48) * 128));
    word = NULL;
   
    nextFrame->GetBytes((void**)&word);

    while(bytes > 0)
    {
        *(word++) = 0x40aa298; //<-- seg fault here. word is not null.
        *(word++) = 0x2a8a62a8;
        *(word++) = 0x298aa040;
        *(word++) = 0x2a8102a8;
        bytes -= 4;
    }

    deckLinkOutput->ScheduleVideoFrame(nextFrame, frameNum * frameDur, frameDur, timescale);   
    nextFrame->Release();
Offline

Tyler Willey

  • Posts: 2
  • Joined: Thu Sep 04, 2014 7:57 pm

Re: Segfault sending more than 1 frame

PostTue Sep 09, 2014 3:37 pm

Is there some sort of debug mode I could enable that might get me more information or logging?

Return to Post Production

Who is online

Users browsing this forum: No registered users and 33 guests