Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bunch of refactoring before changes in the API #110

Merged
merged 3 commits into from
Oct 5, 2017

Conversation

ethouris
Copy link
Collaborator

@ethouris ethouris commented Oct 2, 2017

As per Issue #108

@@ -972,11 +1018,25 @@ bool CRcvBuffer::getRcvFirstMsg(ref_t<uint64_t> tsbpdtime, ref_t<bool> passack,
* Tell 1st valid packet seqno so caller can skip (drop) the missing packets.
*/
skipseqno = m_pUnit[i]->m_Packet.m_iSeqNo;
if ( pppkt )
*pppkt = &m_pUnit[i]->m_Packet;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not look like a "refactoring" change. If this represents a fix that can affect logic elsewhere the change needs to be moved into a separate pull request.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this pppkt plays no logical role here. The use of it is only for logging. This function simply has to return some data that need to be processed further, but the packet itself is of no use to it. I've added extracting the packet just to be able to make the calling function look into its internals, in particular, extract the sequence number. Check core.cpp around line 3766. Previously happened that this number could be not always extracted, so the log was displaying the fallback value 0; this makes the log displaying better.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thank you for explanation! As agreed, there will be a separate PR that will clean up declaration and usage of the packet tracing argument, changing it either to const or seq depending on the usage.

@@ -1389,7 +1449,7 @@ void CRcvBuffer::printDriftOffset(int tsbPdOffset, int tsbPdDriftAvg)
}
#endif /* SRT_DEBUG_TSBPD_DRIFT */

void CRcvBuffer::addRcvTsbPdDriftSample(uint32_t timestamp)
void CRcvBuffer::addRcvTsbPdDriftSample(uint32_t timestamp, pthread_mutex_t& mutex_to_lock)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a refactoring change because it will change logic elsewhere. It should be possible to move this (and corresponding call changes) out to "Fix X locking mechanism" or something along those lines.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, goes to a separate PR.

srtcore/core.cpp Outdated
// inaccurate. Additionally it won't lock if TSBPD mode is off, and
// won't update anything. Note that if you set TSBPD mode and use
// srt_recvfile (which doesn't make any sense), you'll have e deadlock.
m_pRcvBuffer->addRcvTsbPdDriftSample(ctrlpkt.getMsgTimeStamp(), m_RecvLock);
Copy link
Collaborator

@rndi rndi Oct 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a significant change/fix, especially if lock is now not taken under certain conditions. Please move to a separate pull request.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

@rndi rndi merged commit 9c42b34 into Haivision:dev Oct 5, 2017
@rndi
Copy link
Collaborator

rndi commented Oct 5, 2017

Thank you @ethouris !

@ethouris ethouris deleted the dev-refactor-before-new-api branch January 17, 2018 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants