BRAW SDKv1.7 trim job hangs

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

Hendrik Proosa

  • Posts: 1013
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

BRAW SDKv1.7 trim job hangs

PostThu Jun 18, 2020 4:18 pm

Hi,

I have a problem I can't seem to figure out. I want to add trim capabilities to my small video player. Win, braw sdk 1.7.

I create and submit new trim job like this:
Code: Select all
    trimCallback = new CameraCodecCallback();
    HRESULT result = S_OK;

    BSTR clipName;
    clipName = _com_util::ConvertStringToBSTR(outputFileName.toStdString().c_str());

    do {
        result = codec->SetCallback(trimCallback);
        if (result != S_OK)
        {
            break;
        }

        result = clip->CreateJobTrim(clipName, inPoint, outPoint - inPoint + 1, nullptr, nullptr, &trimJob);
        if (result != S_OK)
        {
            break;
        }

        result = trimJob->Submit();
        if (result != S_OK)
        {
            trimJob->Release();
            break;
        }

    } while(0);

Trim job is created and does not fail in any of the results. File is created and so it seems that trim is successfully triggered etc. Problem is, that created .braw file does not open, looks like it is not finalized properly. Trim job seems to never complete beause if I add
Code: Select all
codec->FlushJobs();
it never returns.

Any ideas? I'm probably missing something simple.

Do I have to create new separate decoder instance for trim process maybe..? Currently I reuse the same I create for player.

For processing settings I currently supply nullptr-s because I'm not interested in applying any specific dev settings yet (like example frame decode code does), could this be a problem?
I do stuff.
Offline

Hendrik Proosa

  • Posts: 1013
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

Re: BRAW SDKv1.7 trim job hangs

PostFri Jun 19, 2020 11:35 am

Tried the most basic trim job creation in Linux too, some observations. I am able to produce a .braw file, get trim progress printout and detect trim process complete. Application also exits normally. But created .braw file does not play in official braw player, although original, from which trim was done, plays without problems.

Adding
Code: Select all
codec->FlushJobs();
leaves application hanging and I also don't get progress printout as if it doesn't even start. My impression from docs is that it should wait until all codec jobs are processed, but seems that it disables the callback mechanism and also never returns when trim job is in processing queue. Flushing works as expected in case of frame processing jobs.
I do stuff.
Offline

CaptainHook

Blackmagic Design

  • Posts: 1718
  • Joined: Wed Aug 22, 2012 4:50 am
  • Location: Melbourne, Australia
  • Real Name: Hook

Re: BRAW SDKv1.7 trim job hangs

PostTue Jun 23, 2020 6:19 am

Hi, can you upload an example of one of your trimmed clips?
How are you processing the trimComplete callback?
**Any post by me prior to Aug 2014 was before i started working for Blackmagic**
Offline

Hendrik Proosa

  • Posts: 1013
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

Re: BRAW SDKv1.7 trim job hangs

PostTue Jun 23, 2020 8:07 am

Hi, I uploaded one example trim here: https://drive.google.com/drive/folders/ ... sp=sharing

Source for it was one of the example braw files from BMD website, Rabbit_ear_clones.
I'm currently not doing anything in trimComplete callback besides printing to std::cout to see it was called. It is called and prints to cout if I don't add the flushJobs and does not get called if I do.
I do stuff.
Offline

CaptainHook

Blackmagic Design

  • Posts: 1718
  • Joined: Wed Aug 22, 2012 4:50 am
  • Location: Melbourne, Australia
  • Real Name: Hook

Re: BRAW SDKv1.7 trim job hangs

PostThu Jun 25, 2020 11:20 pm

Your implementation of the TrimCallback function needs to in addition to any of your own processing also release the job (job->Release()), where the job is passed in as the first argument.
Once this is in place, you can use FlushJobs() to wait for completion.
**Any post by me prior to Aug 2014 was before i started working for Blackmagic**
Offline

Hendrik Proosa

  • Posts: 1013
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

Re: BRAW SDKv1.7 trim job hangs

PostFri Jun 26, 2020 6:56 am

Thanks for the info! So I must release the job inside trimComplete(), as I understand it? I'll add it and report back. I suspected it is something simple I'm missing.

May I ask why a trim job must be released? Why doesn't automatically release itself when trim is complete?
I do stuff.
Offline

Hendrik Proosa

  • Posts: 1013
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

Re: BRAW SDKv1.7 trim job hangs

PostFri Jun 26, 2020 7:55 am

Adding
Code: Select all
job->Release()
to trimComplete callback did the trick, thanks again!

May I suggest stating it clearly in BRAW documentation too, I looked specifically for this now and was unable to find any mention of necessity to explicitly release the trim job. From other example code I can now see that job is released when frame is processed etc but it was not obvious to add it to trim job (maybe it's just me :D). A minimal trim example would also be nice in sdk samples.
I do stuff.
Offline

CaptainHook

Blackmagic Design

  • Posts: 1718
  • Joined: Wed Aug 22, 2012 4:50 am
  • Location: Melbourne, Australia
  • Real Name: Hook

Re: BRAW SDKv1.7 trim job hangs

PostFri Jun 26, 2020 1:05 pm

Glad it worked, noted on the feedback. We have limited resources and time so as for anyone its a case of trying to get as much done as possible and prioritize as best we can. Thanks.
**Any post by me prior to Aug 2014 was before i started working for Blackmagic**

Return to Software Developers

Who is online

Users browsing this forum: Bing [Bot] and 5 guests