Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

Can't find samples for GvrAudioSurround usage #366

Closed
anton-knyazev opened this issue Feb 9, 2017 · 5 comments
Closed

Can't find samples for GvrAudioSurround usage #366

anton-knyazev opened this issue Feb 9, 2017 · 5 comments

Comments

@anton-knyazev
Copy link

Tried to play with it for a while, but it keeps crashing for me. Can you please provide me with samples for it or any helpful links?

@jkammerl
Copy link
Member

jkammerl commented Feb 9, 2017

We'll work on a sample to demonstrate the integration into the ExoPlayer. In the meantime, could you explain in more detail how it crashes?

@anton-knyazev
Copy link
Author

anton-knyazev commented Feb 10, 2017

int duration = 3; // seconds
int sampleRate = 11025;
int numSamples = duration * sampleRate;
double sample[] = new double[numSamples];
double freqOfTone = 440; // hz
byte generatedSnd[] = new byte[2 * numSamples];
ByteBuffer inputByteBuffer = ByteBuffer.wrap(generatedSnd)
  
GvrAudioSurround   surroundEngine = new GvrAudioSurround(GvrAudioSurround.SurroundFormat.SURROUND_STEREO,
                sampleRate, 2, numSamples * 2);
surroundEngine.addInput(inputByteBuffer, inputByteBuffer.position() , inputByteBuffer.limit()); // crash

Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 7545 (com.example.app)
debuggerd: handling request: pid=7545 uid=10103 gid=10103 tid=7545


Build fingerprint: 'google/bullhead/bullhead:7.1.1/N4F26I/3532671:user/release-keys'
Revision: 'rev_1.0'
ABI: 'arm64'
pid: 7545, tid: 7545, name: com.example.app >>> com.example.app <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
x0 0000000000000000 x1 0000000000000002 x2 000000767c1c72a8 x3 0000000000004099
x4 0000000000000000 x5 000000767c8bcd90 x6 0000000000000000 x7 0000000000000000
x8 0000000000000002 x9 000000765f50d000 x10 0000000000000002 x11 00000000ffffffff
x12 0000007696a0c630 x13 0000007696c03e00 x14 0000007696c03e00 x15 0000000000000000
x16 000000767cac2c68 x17 0000007697061908 x18 0000000000ffffeb x19 000000767c1c7260
x20 0000000000004099 x21 0000000000004099 x22 0000000000004099 x23 0000000000000000
x24 000000767a3c1180 x25 0000000000010266 x26 0000007696a95a98 x27 0000000000000001
x28 0000007696a95a00 x29 0000007ffe3e8fd8 x30 000000767ca64c48
sp 0000007ffe3e8ce0 pc 000000767ca64f18 pstate 0000000080000000
backtrace:
#00 pc 000000000005af18 /data/app/com.example.app-2/lib/arm64/libgvr_audio.so
#1 pc 000000000005ac44 /data/app/com.example.app-2/lib/arm64/libgvr_audio.so
#2 pc 0000000000018150 /data/app/com.example.app-2/lib/arm64/libgvr_audio.so
#3 pc 0000000000015cfc /data/app/com.example.app-2/lib/arm64/libgvr_audio.so (Java_com_google_vr_sdk_audio_GvrAudioSurround_nativeAddInput+584)
#4 pc 00000000004cd154 /data/app/com.example.app-2/oat/arm64/base.odex (offset 0x492000)

@virajkarandikar
Copy link

Seeing same issue. addInput() call crashes.

@jkammerl
Copy link
Member

jkammerl commented Feb 13, 2017

Thanks for the report. It seems crashing when trying to throw an Exception about the input buffer type.
We'll fix this in the next release and update the documentation accordingly. In the meantime, you should switch to direct ByteBuffers for audio I/O and it should work.

  ByteBuffer inputByteBuffer =
    ByteBuffer.allocateDirect(2 // num channels  
        * 2 // 16bit samples 
        *  numSamples).order(ByteOrder.LITTLE_ENDIAN);

@virajkarandikar
Copy link

Thanks. Using allocateDirect works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants