A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Haivision/srt/commit/ec571a034990499df0cae406873084a58dbe8cb1 below:

[core] Fixed new RCV buffer in stream mode · Haivision/srt@ec571a0 · GitHub

@@ -369,9 +369,10 @@ namespace {

369 369

/// @brief Writes bytes to file stream.

370 370

/// @param data pointer to data to write.

371 371

/// @param len the number of bytes to write

372 +

/// @param dst_offset ignored

372 373

/// @param arg a void pointer to the fstream to write to.

373 374

/// @return true on success, false on failure

374 -

bool writeBytesToFile(char* data, int len, void* arg)

375 +

bool writeBytesToFile(char* data, int len, int dst_offset SRT_ATR_UNUSED, void* arg)

375 376

{

376 377

fstream* pofs = reinterpret_cast<fstream*>(arg);

377 378

pofs->write(data, len);

@@ -381,11 +382,12 @@ namespace {

381 382

/// @brief Copies bytes to the destination buffer.

382 383

/// @param data pointer to data to copy.

383 384

/// @param len the number of bytes to copy

385 +

/// @param dst_offset offset in destination buffer

384 386

/// @param arg A pointer to the destination buffer

385 387

/// @return true on success, false on failure

386 -

bool copyBytesToBuf(char* data, int len, void* arg)

388 +

bool copyBytesToBuf(char* data, int len, int dst_offset, void* arg)

387 389

{

388 -

char* dst = reinterpret_cast<char*>(arg);

390 +

char* dst = reinterpret_cast<char*>(arg) + dst_offset;

389 391

memcpy(dst, data, len);

390 392

return true;

391 393

}

@@ -427,7 +429,7 @@ int CRcvBufferNew::readBufferTo(int len, copy_to_dst_f funcCopyToDst, void* arg)

427 429

const int remain_pktlen = pktlen - m_iNotch;

428 430

const int unitsize = std::min(remain_pktlen, rs);

429 431 430 -

if (!funcCopyToDst(pkt.m_pcData + m_iNotch, unitsize, arg))

432 +

if (!funcCopyToDst(pkt.m_pcData + m_iNotch, unitsize, len - rs, arg))

431 433

break;

432 434 433 435

if (rs >= remain_pktlen)

@@ -622,45 +624,23 @@ void CRcvBufferNew::updateNonreadPos()

622 624

if (m_iMaxPosInc == 0)

623 625

return;

624 626 625 -

// const PacketBoundary boundary = packet.getMsgBoundary();

626 - 627 -

//// The simplest case is when inserting a sequential PB_SOLO packet.

628 -

// if (boundary == PB_SOLO && (m_iFirstNonreadPos + 1) % m_szSize == pos)

629 -

//{

630 -

// m_iFirstNonreadPos = pos;

631 -

// return;

632 -

//}

633 627

const int end_pos = incPos(m_iStartPos, m_iMaxPosInc); // The empty position right after the last valid entry.

634 628 635 629

int pos = m_iFirstNonreadPos;

636 -

while (m_entries[pos].pUnit && m_entries[pos].status == EntryState_Avail && (m_entries[pos].pUnit->m_Packet.getMsgBoundary() & PB_FIRST))

630 +

while (m_entries[pos].pUnit && m_entries[pos].status == EntryState_Avail)

637 631

{

638 -

// bool good = true;

639 - 640 -

// look ahead for the whole message

641 - 642 -

// We expect to see either of:

643 -

// [PB_FIRST] [PB_SUBSEQUENT] [PB_SUBSEQUENT] [PB_LAST]

644 -

// [PB_SOLO]

645 -

// but not:

646 -

// [PB_FIRST] NULL ...

647 -

// [PB_FIRST] FREE/PASSACK/DROPPED...

648 -

// If the message didn't look as expected, interrupt this.

649 - 650 -

// This begins with a message starting at m_iStartPos

651 -

// up to end_pos (excluding) OR until the PB_LAST message is found.

652 -

// If any of the units on this way isn't good, this OUTER loop

653 -

// will be interrupted.

654 -

for (int i = pos; i != end_pos; i = (i + 1) % m_szSize)

632 +

if (m_bMessageAPI && (m_entries[pos].pUnit->m_Packet.getMsgBoundary() & PB_FIRST) == 0)

633 +

break;

634 + 635 +

for (int i = pos; i != end_pos; i = incPos(i))

655 636

{

656 637

if (!m_entries[i].pUnit || m_entries[pos].status != EntryState_Avail)

657 638

{

658 -

// good = false;

659 639

break;

660 640

}

661 641 662 -

// Likewise, boundary() & PB_LAST will be satisfied for last OR solo.

663 -

if (m_entries[i].pUnit->m_Packet.getMsgBoundary() & PB_LAST)

642 +

// Check PB_LAST only in message mode.

643 +

if (!m_bMessageAPI || m_entries[i].pUnit->m_Packet.getMsgBoundary() & PB_LAST)

664 644

{

665 645

m_iFirstNonreadPos = incPos(i);

666 646

break;

@@ -672,11 +652,6 @@ void CRcvBufferNew::updateNonreadPos()

672 652 673 653

pos = m_iFirstNonreadPos;

674 654

}

675 - 676 -

// 1. If there is a gap between this packet and m_iLastReadablePos

677 -

// then no sense to update m_iLastReadablePos.

678 - 679 -

// 2. The simplest case is when this is the first sequential packet

680 655

}

681 656 682 657

int CRcvBufferNew::findLastMessagePkt()

@@ -929,9 +904,10 @@ string CRcvBufferNew::strFullnessState(int iFirstUnackSeqNo, const time_point& t

929 904

{

930 905

ss << ":n/a ms";

931 906

}

907 +

ss << ". ";

932 908

}

933 909 934 -

ss << ". " SRT_SYNC_CLOCK_STR " drift " << getDrift() / 1000 << " ms.";

910 +

ss << SRT_SYNC_CLOCK_STR " drift " << getDrift() / 1000 << " ms.";

935 911

return ss.str();

936 912

}

937 913

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4