Skip to content

Tests and fixes for seeking and skipping in audio streams#1124

Merged
rryan merged 8 commits intomixxxdj:masterfrom
uklotzde:soundsource_tests_and_fixes
Jan 17, 2017
Merged

Tests and fixes for seeking and skipping in audio streams#1124
rryan merged 8 commits intomixxxdj:masterfrom
uklotzde:soundsource_tests_and_fixes

Conversation

@uklotzde
Copy link
Copy Markdown
Contributor

I added the following test cases for SoundSources:

  • Seek and read samples (repeatedly and alternating)
  • Seek to stream boundaries followed by verified reading from the middle of the stream

Apparently various implementations were broken! All fixed with one exception: Seeking near the end of an MP3 stream fails with SoundSourceMP3 (libmad). I temporarily excluded/disabled the failing test and marked it with a TODO. I have no idea what's going wrong here.

The fix for SoundSourceOpus is the biggest one, because opusfile neither implements skipping nor provides sample accurate seeking and decoding. By prefetching sample frames while seeking the accuracy can be improved substantially. All tunable parameters that affect the sample accuracy are now defined in SoundSourceOpus and are available as constants for verifying the test results.

@uklotzde
Copy link
Copy Markdown
Contributor Author

Some additional commits (trial and error) were necessary to fix the build and tests for all supported platforms.

Copy link
Copy Markdown
Member

@rryan rryan left a comment

Choose a reason for hiding this comment

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

I skimmed the decoder changes and they look good -- since there is high test coverage I didn't do a thorough review. Thanks!

Comment thread src/util/audiosignal.cpp Outdated
// TODO(XXX): Replace 'static const' with 'static constexpr'
// in the corresponding .h file after upgrading to Visual
// Studio 2015 and remove all definitions from this .cpp file.
#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"not Visual Studio OR Visual Studio 2015 and newer"

Is that what you intended? Did you mean "only Visual Studio earlier than 2015"?

#if defined(_MSC_VER) && (_MSC_VER < 1900)

Copy link
Copy Markdown
Contributor Author

@uklotzde uklotzde Jan 16, 2017

Choose a reason for hiding this comment

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

GCC: With or without definitions, doesn't matter -> optional
LLVM: Definitions are mandatory
Visual Studio 2013: Definitions produce link errors -> forbidden

There is no intersection that works for all 3 compilers: I decided to add the definitions as a default with an exception for Visual Studio <= 2013. Starting with the Visual Studio 2015 the definitions will be included (as for GCC/LLVM) and we will see what happens.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm ok. But I'm still confused why this builds successfully at head?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's confusing is that master builds fine with clang and the static constants defined inline in audiosignal.h and not in audiosignal.o, which contradicts what you are saying about them being mandatory?

Comment thread src/util/audiosignal.cpp Outdated

namespace mixxx {

// Definitions of static class constants are required by
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

are not required?

Comment thread src/util/audiosignal.cpp Outdated

// Definitions of static class constants are required by
// LLVM CLang, but cause "multiply defined symbols" errors
// in Visual Studio 2013. GCC is happy either with or
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

GCC/Clang?

Comment thread src/util/audiosignal.cpp Outdated

// Definitions of static class constants are required by
// LLVM CLang, but cause "multiply defined symbols" errors
// in Visual Studio 2013. GCC is happy either with or
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm confused -- how does this build at head (since Travis/Appveyor uses all of GCC, LLVM, and MSVC2013)?

@uklotzde
Copy link
Copy Markdown
Contributor Author

uklotzde commented Jan 16, 2017 via email

@uklotzde
Copy link
Copy Markdown
Contributor Author

uklotzde commented Jan 17, 2017 via email

@rryan
Copy link
Copy Markdown
Member

rryan commented Jan 17, 2017

I have reset the branch and excluded the confusing workaround. Now the build for OS X fails:

Very weird, so it must be some change within this PR that causes clang to need this? The constants were already used within multiple .o's before this PR.

@rryan
Copy link
Copy Markdown
Member

rryan commented Jan 17, 2017

Sorry @uklotzde , I didn't mean to make you waste time on this when what you had was working. I was just curious what the reason was. We can merge what you had if you force push it back.

@rryan rryan merged commit 5f1a20c into mixxxdj:master Jan 17, 2017
@timrae
Copy link
Copy Markdown
Contributor

timrae commented Jan 20, 2017

On ubuntu 16.10, gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
scons -j8 optimize=off faad=1 fails with linking errors:

lin64_build/sources/soundsourceopus.o: In function `mixxx::SoundSourceOpus::tryOpen(mixxx::AudioSourceConfig const&)': /home/tim/development/mixxx/src/sources/soundsourceopus.cpp:205: undefined reference to `mixxx::AudioSignal::kChannelCountStereo' collect2: error: ld returned 1 exit status scons: *** [lin64_build/mixxx] Error 1 scons: building terminated because of errors.

Note that optimize=native works as expected

@uklotzde
Copy link
Copy Markdown
Contributor Author

uklotzde commented Jan 21, 2017 via email

@uklotzde uklotzde deleted the soundsource_tests_and_fixes branch January 21, 2017 17:08
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.

3 participants