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

Refactor UpdateDisplay() to call UpdateUploadRate() #3369

Merged

Conversation

ann0see
Copy link
Member

@ann0see ann0see commented Sep 13, 2024

Short description of changes

Refactor UpdateDispay() method. This was extracted from #2550
and is related to: https://github.com/jamulussoftware/jamulus/pull/3364/files/21815c1a0708979fe0414c30e0294feaa7632be3#r1759185427

It makes sense to call UpdateUploadRate() from UpdateDisplay() since it gets same functionality to the same place.

Not sure, if the condition is correct, as we do not check if pClient is running, but rather it is connected now.

CHANGELOG: SKIP

Context: Fixes an issue?

No.

Does this change need documentation? What needs to be documented and how?

No. This even adds documentation

Status of this Pull Request

Ready for review

What is missing until this pull request can be merged?

Review. Tested locally by disconnecting and connecting via GUI and changing Audio quality and enabling/disabling small network buffers. Network rate shows correctly. Also checked by starting Jamulus with -c flag and seems to do what it should do: Label shows correct data if connected and --- if not connected.

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

@@ -1063,25 +1063,31 @@ void CClientSettingsDlg::OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton
UpdateDisplay();
}

/// @method
Copy link
Member Author

@ann0see ann0see Sep 13, 2024

Choose a reason for hiding this comment

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

Probably no need to add @ method here.

ann0see added a commit to ann0see/jamulus that referenced this pull request Sep 13, 2024
@ann0see ann0see force-pushed the refactoring/UploadRateSettings branch from c710c60 to 052d875 Compare September 22, 2024 15:52
@ann0see ann0see added this to the Release 3.12.0 milestone Sep 22, 2024
@ann0see ann0see self-assigned this Sep 22, 2024
@ann0see ann0see added the refactoring Non-behavioural changes, Code cleanup label Sep 22, 2024
UpdateJitterBufferFrame();
UpdateSoundCardFrame();

if ( !pClient->IsRunning() )
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is

bool IsRunning() { return Sound.IsRunning(); }

lblUpstreamValue->setText ( QString().setNum ( pClient->GetUploadRateKbps() ) );
lblUpstreamUnit->setText ( "kbps" );
// update upstream rate information label if needed
if ( pClient->IsConnected() )
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is

bool IsConnected() { return Channel.IsConnected(); }

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. That's from https://github.com/jamulussoftware/jamulus/pull/2550/files#diff-d5cde46c72d0c085d1d2c0ca59957407b17931c2f194a33268b3535169006629R1042

A potential semantic change. Probably worth reverting to IsRunning() unless proven to be incorrect.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd like to hear a second OK/not OK from someone nevertheless.

// update upstream rate information label if needed
if ( pClient->IsConnected() )
{
lblUpstreamValue->setText ( QString().setNum ( pClient->GetUploadRateKbps() ) );
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is

int GetUploadRateKbps() { return Channel.GetUploadRateKbps(); }

So it makes far more sense to check the Channel.IsConnected().

But really, it's down to the audio settings, nothing to do with whether a sound card is connected or a server is connected:
image
It can be computed from those values, I think. (But it's probably the Channel that gets passed the values to do the computation - it gets passed uncompressed audio and does the number crunching.)

@pljones
Copy link
Collaborator

pljones commented Sep 22, 2024

Currently we show the rate only on the settings page.

The factor that connecting to a server affects in the calculation is the "Small Buffers" overhead, I think. I can't think of anything else that would need to check for server support before performing the calculation.

Originally - before "Small Buffers" - I think it was calculated just from the audio settings, as the network overheads were fixed.

So I guess this change makes sense and is, therefore, long overdue.

@ann0see
Copy link
Member Author

ann0see commented Oct 4, 2024

@softins could you please have a look at this?

@ann0see ann0see requested review from softins and removed request for softins October 16, 2024 20:22
Copy link
Member

@softins softins left a comment

Choose a reason for hiding this comment

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

Code looks sensible. Compiled and tested ok on a Pi. (sorry for the delay)

@ann0see ann0see merged commit 815011f into jamulussoftware:main Oct 17, 2024
11 checks passed
@ann0see ann0see deleted the refactoring/UploadRateSettings branch October 17, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Non-behavioural changes, Code cleanup
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants