Split direct v210 read and copy timing
This commit is contained in:
+34
-2
@@ -575,10 +575,17 @@ const VideoFrame& MxlSdkFeed::getFrame(uint32_t frameCounter)
|
||||
bool MxlSdkFeed::readV210FrameInto(
|
||||
uint32_t frameCounter,
|
||||
void* destination,
|
||||
size_t destinationSize)
|
||||
size_t destinationSize,
|
||||
V210ReadTiming* timing)
|
||||
{
|
||||
(void)frameCounter;
|
||||
|
||||
if (timing != nullptr)
|
||||
{
|
||||
timing->sourceReadNs = 0;
|
||||
timing->payloadCopyNs = 0;
|
||||
}
|
||||
|
||||
if (!mFlowOpened && !openFlow())
|
||||
{
|
||||
return false;
|
||||
@@ -598,6 +605,8 @@ bool MxlSdkFeed::readV210FrameInto(
|
||||
|
||||
uint8_t* payload = nullptr;
|
||||
|
||||
const auto readStart = std::chrono::steady_clock::now();
|
||||
|
||||
while (true)
|
||||
{
|
||||
mxlStatus status = mxlFlowReaderGetGrainNonBlocking(
|
||||
@@ -653,6 +662,8 @@ bool MxlSdkFeed::readV210FrameInto(
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto readEnd = std::chrono::steady_clock::now();
|
||||
|
||||
const size_t payloadSize =
|
||||
static_cast<size_t>(mSourceStride) *
|
||||
static_cast<size_t>(mSourceHeight);
|
||||
@@ -665,7 +676,22 @@ bool MxlSdkFeed::readV210FrameInto(
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto copyStart = std::chrono::steady_clock::now();
|
||||
std::memcpy(destination, payload, payloadSize);
|
||||
const auto copyEnd = std::chrono::steady_clock::now();
|
||||
|
||||
if (timing != nullptr)
|
||||
{
|
||||
timing->sourceReadNs =
|
||||
static_cast<uint64_t>(
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
readEnd - readStart).count());
|
||||
timing->payloadCopyNs =
|
||||
static_cast<uint64_t>(
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
copyEnd - copyStart).count());
|
||||
}
|
||||
|
||||
mLastDisplayedIndex = index;
|
||||
++mFrameVersion;
|
||||
return true;
|
||||
@@ -793,11 +819,17 @@ bool MxlSdkFeed::supportsDirectV210Read() const { return false; }
|
||||
bool MxlSdkFeed::readV210FrameInto(
|
||||
uint32_t frameCounter,
|
||||
void* destination,
|
||||
size_t destinationSize)
|
||||
size_t destinationSize,
|
||||
V210ReadTiming* timing)
|
||||
{
|
||||
(void)frameCounter;
|
||||
(void)destination;
|
||||
(void)destinationSize;
|
||||
if (timing != nullptr)
|
||||
{
|
||||
timing->sourceReadNs = 0;
|
||||
timing->payloadCopyNs = 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
uint32_t MxlSdkFeed::v210Width() const { return 0; }
|
||||
|
||||
Reference in New Issue
Block a user