Skip to content

Conversation

HelgeStenstrom
Copy link
Collaborator

Description

Related to #55

Re-assignment of audioInputStream removed by changing
audioInputStream = AudioSystem.getAudioInputStream(targetFormat, audioInputStream);

to assignment of a new variable.
Variable name changes: Initial audioInputStream changed to encodedAudioInputStream
audioInputStream after the re-assignment now assigned to a field called decodedAudioInputStream.
Old encodedAudioInputStream renamed to encodedAudioInputStreamCopy.

encodedAudioInputStream doesn't change, so it doesn't have to be volatile.

According to Sonar, Non-primitive fields should not be "volatile"
For primitive fields volatile inhibits caching. This is only of interest of the field changes value, but this one doesn't. Since the field is an object reference, value change in this context means that it gets replaced with a different object, but it will not happen.

See also https://wiki.sei.cmu.edu/confluence/display/java/CON50-J.+Do+not+assume+that+declaring+a+reference+volatile+guarantees+safe+publication+of+the+members+of+the+referenced+object

There are no dependencies for this change.

What kind of change does this PR introduce? (check at least one)

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code style update
  • Refactor
  • Build-related changes
  • This change requires a documentation update
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Has This Been Tested?

  • Yes
  • No

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
HelgeStenstrom and others added 8 commits December 18, 2019 22:43
Some unit tests are improved, but there are more to be done.
Re-assignment of audioInputStream removed by changing audioInputStream = AudioSystem.getAudioInputStream(targetFormat, audioInputStream); to assignment of a new variable. Variable name changes: Initial audioInputStream changed to encodedAudioInputStream audioInputStream after the re-assignment now assigned to a field called decodedAudioInputStream. Old encodedAudioInputStream renamed to encodedAudioInputStreamCopy.
…tile. According to Sonar, Non-primitive fields should not be "volatile" For primitive fields volatile inhibits caching. This is only of interest of the field changes value, but this one doesn't. Since the field is an object reference, value change in this context means that it gets replaced with a different object, but it will not happen. See also https://wiki.sei.cmu.edu/confluence/display/java/CON50-J.+Do+not+assume+that+declaring+a+reference+volatile+guarantees+safe+publication+of+the+members+of+the+referenced+object
StreamPlayerMethodsTest still contains tests that don't pass. The tested methods are candidates for removal from StreamPlayer. All tests in StreamPlayerMethodsTest must be reviewed: Do they actually verify anything that need to be verified? Or are they too coupled with the current implementation? StreamPlayerFutureImprovementTest contains tests that currently fail. Failures are caused by behavior in StreamPlayer which I think is wrong or bad. But I may have misinterpreted the intended behavior.
@goxr3plus
Copy link
Owner

I finally had time to check this pull request .

Also by looking on the folder https://github.com/goxr3plus/java-stream-player/tree/master/src/main/java/com/goxr3plus/streamplayer/application we are having many demos , why we need all of them : )?

AudioSystem.getMixerInfo() will not return null, so we don't have to …
@HelgeStenstrom
Copy link
Collaborator Author

The demo applications are outside the scope of this pull request, I think.

goxr3plus and others added 5 commits February 27, 2020 12:02
Re-assignment of audioInputStream removed by changing audioInputStream = AudioSystem.getAudioInputStream(targetFormat, audioInputStream); to assignment of a new variable. Variable name changes: Initial audioInputStream changed to encodedAudioInputStream audioInputStream after the re-assignment now assigned to a field called decodedAudioInputStream. Old encodedAudioInputStream renamed to encodedAudioInputStreamCopy.
…tile. According to Sonar, Non-primitive fields should not be "volatile" For primitive fields volatile inhibits caching. This is only of interest of the field changes value, but this one doesn't. Since the field is an object reference, value change in this context means that it gets replaced with a different object, but it will not happen. See also https://wiki.sei.cmu.edu/confluence/display/java/CON50-J.+Do+not+assume+that+declaring+a+reference+volatile+guarantees+safe+publication+of+the+members+of+the+referenced+object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants