Dropping frames after a while

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

thomasgodon

  • Posts: 14
  • Joined: Tue Mar 19, 2013 3:22 pm

Dropping frames after a while

PostMon Jan 19, 2015 5:05 pm

Hi,

I'm running 3 outputs of 1 decklink Quad. I developed an application in OS X where I can load an Quartz Composer file and then render it out to the decklink Devices. Everything is running perfect.

But after a while (5mins when running HD - 1080i50 and 15mins when running SD - 576i) there are dropping many frames.
Any idea where I can start looking?

thx!
Thomas Godon
Offline

thomasgodon

  • Posts: 14
  • Joined: Tue Mar 19, 2013 3:22 pm

Re: Dropping frames after a while

PostFri Jan 23, 2015 6:11 pm

Is it possible that the timing isn't correct afther a while? Im using integers for timing.

Anyone has an idea?
Offline

Matt Jefferson

Blackmagic Design

  • Posts: 130
  • Joined: Fri Aug 31, 2012 12:50 am

Re: Dropping frames after a while

PostMon Jan 26, 2015 6:43 pm

Thomas - I will recommend that you try 10.3.5 This driver includes many updates for SDI, Duo and Quad proudcts. It was loaded to our support page on January 23, 2015.

At times, dropped frames can be traced to lower than required disk speed for uncompressed data rates. 4 channel Quad would require a lot of disk speed to handle playback and capture.
If you are still having issues on dropping frames recommend you contact support via our email function at the bottom middle section of the main support page.

Matt Jefferson
Offline

thomasgodon

  • Posts: 14
  • Joined: Tue Mar 19, 2013 3:22 pm

Re: Dropping frames after a while

PostTue Jan 27, 2015 7:58 pm

Hi Matt,

thx for the answer! I'm only handle playback on 3 outputs of a decklink quad on a Mac Mini with SSD inside. I'm only rendering some vector based quartz composer (openGL) files. So there shouldn't be much disk activity i guess? I'm scheduling 3 frames, then start a playback. Then always after 5 mins there are dropping frames at 1080i50 and after 15mins when i'm running at 576i.

But first I will try the new 10.3.5 driver!

thx!
Thomas
Offline

thomasgodon

  • Posts: 14
  • Joined: Tue Mar 19, 2013 3:22 pm

Re: Dropping frames after a while

PostWed Jan 28, 2015 1:08 pm

Hi,

So I tested the new drivers but the problem is not solved. It's seems like the frames are dropping earlier when i'm using the computer while i'm doing a playback. So it might be a performance issue. But I doubt because I can run CasparCG with the same decklink card (Quad) onto the same MacMini without having dropped frames.

So back to the OSX part.

In my code i'm tracing for dropped and late frames. If there are such frames I push the timescale 1 frame up to catch that delay. It's seems to work cause when I playback 3 streams i'm not having frames dropped after 15mins (576i) like I had before. Sometimes I can see in my log there was a dropped frame. But the code caches by the frame after.

Then after 20 to 30 mins every output starts randomly dropping frames and even while pushing the timescale 1 frame into the future the frames keep dropping or displaying late.

Anyone has an idea?

Here you can find my code where I push the frames into the future after dropping or displaying late:

Code: Select all
HRESULT      PlaybackDelegate::ScheduledFrameCompleted (IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult result)
{
    if ((result == bmdOutputFrameDisplayedLate) || (result == bmdOutputFrameDropped))
    {
        // if dropped bump scheduled time further into the future by one frame
        [pDecklinkDevice increaseScheduledFrames];
        NSLog(@"bumped %d", [pDecklinkDevice getOutputID]);
    }
   
    if ([pDecklinkDevice getIsRunning] == TRUE)
    {
        [pDecklinkDevice createVideoFrame:TRUE];
    }
   return S_OK;
}

- (void) increaseScheduledFrames
{
    totalFramesScheduled += 1;
}


and this is my code where I create a new frame and schedule that one

Code: Select all
- (void) createVideoFrame:(BOOL)schedule
{
    @autoreleasepool
    {
        // get displaymode
        IDeckLinkDisplayMode* decklinkdisplaymode = (IDeckLinkDisplayMode*)CurrentRes;
   
        // create new videoframe on output
        if (deckLinkOutput->CreateVideoFrame((int)decklinkdisplaymode->GetWidth(), (int)decklinkdisplaymode->GetHeight(), (int)decklinkdisplaymode->GetWidth() * 4, bmdFormat8BitARGB, bmdFrameFlagFlipVertical, &videoFrame) != S_OK)
        {
            // failed to create new video frame on output
            // display terminal message
            sendMessageToTerminal = [[mogiTerminalMessage alloc] initWithSendNotification:@"terminalErrorMessage" forMessage:[NSString stringWithFormat:@"DeckLink: Output %d -> Failed to create new videoframe", outputID]];
        }
       
        unsigned frameBufferRowBytes = ((int)decklinkdisplaymode->GetWidth() * 4 + 63) & ~63;
        void* frameBufferPtr = valloc((int)decklinkdisplaymode->GetHeight() * frameBufferRowBytes);
       
        // set videoframe pointer
        if (videoFrame != NULL)
        {
            videoFrame->GetBytes((void**)&frameBufferPtr);
        }
       
        // fill pointer with pixel data
        if (scheduleBlack == TRUE)
        {
            [qClear renderFrameAtTime:1.0 forBuffer:(void**)frameBufferPtr forScreen:0];
           
            // render first frame qRenderer
            if (qRender != NULL)
            {
                [qRender renderFirstFrame];
            }
        }
        else
        {
            [qRender renderFrameAtTime:totalSecondsScheduled forBuffer:(void**)frameBufferPtr forScreen:screenID];
            schedule = TRUE;
        }
       
        // if playback -> schedule frame
        if (schedule == TRUE)
        {
            // schedule frame
            if (videoFrame != NULL)
            {
                if (deckLinkOutput->ScheduleVideoFrame(videoFrame, (totalFramesScheduled * frameDuration), frameDuration, frameTimescale) != S_OK)
                {
                    // failed to schedule new frame
                    // display message to terminal
                    sendMessageToTerminal = [[mogiTerminalMessage alloc] initWithSendNotification:@"terminalErrorMessage" forMessage:[NSString stringWithFormat:@"DeckLink: Output %d -> Failed to schedule new videoframe", outputID]];
                }
                else
                {
                    // increase totalFramesScheduled
                    totalFramesScheduled += 1;
                   
                    // increase totalSecondsScheduled
                    totalSecondsScheduled += 1.0/framesPerSecond;
                }
               
                // clear videoframe
                videoFrame->Release();
                videoFrame = NULL;
            }
        }
    }
}

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 7 guests