| Index: ports/sdl/nacl.patch
|
| diff --git a/ports/sdl/nacl.patch b/ports/sdl/nacl.patch
|
| index 76345ee20ff9598844650f2f85f64474b8b8ae1e..07ceed86e9f1f30d10fc0b03c0e87c386c9ea754 100644
|
| --- a/ports/sdl/nacl.patch
|
| +++ b/ports/sdl/nacl.patch
|
| @@ -323,10 +323,10 @@ index 50cf179..7b9a0a7 100644
|
| #endif
|
| diff --git a/src/audio/nacl/SDL_naclaudio.cc b/src/audio/nacl/SDL_naclaudio.cc
|
| new file mode 100644
|
| -index 0000000..908a498
|
| +index 0000000..7a02156
|
| --- /dev/null
|
| +++ b/src/audio/nacl/SDL_naclaudio.cc
|
| -@@ -0,0 +1,150 @@
|
| +@@ -0,0 +1,140 @@
|
| +#include "SDL_config.h"
|
| +#include "SDL_naclaudio.h"
|
| +
|
| @@ -401,12 +401,10 @@ index 0000000..908a498
|
| +
|
| + _this->hidden->mutex = SDL_CreateMutex();
|
| +
|
| -+ _this->hidden->opened = false;
|
| -+
|
| + // TODO: Move audio device creation to NACLAUD_OpenAudio.
|
| -+ const PPB_Audio_1_1* g_nacl_audio_interface =
|
| ++ g_nacl_audio_interface =
|
| + (const PPB_Audio_1_1*)g_nacl_get_interface(PPB_AUDIO_INTERFACE_1_1);
|
| -+ const PPB_AudioConfig_1_1* g_nacl_audio_config_interface =
|
| ++ g_nacl_audio_config_interface =
|
| + (const PPB_AudioConfig_1_1*)g_nacl_get_interface(
|
| + PPB_AUDIO_CONFIG_INTERFACE_1_1);
|
| +
|
| @@ -438,9 +436,6 @@ index 0000000..908a498
|
| +};
|
| +
|
| +static void NACLAUD_CloseAudio(_THIS) {
|
| -+ SDL_LockMutex(_this->hidden->mutex);
|
| -+ _this->hidden->opened = 0;
|
| -+ SDL_UnlockMutex(_this->hidden->mutex);
|
| +}
|
| +
|
| +static void AudioCallback(void* samples, uint32_t buffer_size, PP_TimeDelta,
|
| @@ -448,7 +443,8 @@ index 0000000..908a498
|
| + SDL_AudioDevice* _this = reinterpret_cast<SDL_AudioDevice*>(data);
|
| +
|
| + SDL_LockMutex(_this->hidden->mutex);
|
| -+ if (_this->hidden->opened) {
|
| ++ /* Only do anything if audio is enabled and not paused */
|
| ++ if (_this->enabled && !_this->paused) {
|
| + SDL_memset(samples, _this->spec.silence, buffer_size);
|
| + SDL_LockMutex(_this->mixer_lock);
|
| + (*_this->spec.callback)(_this->spec.userdata, (Uint8*)samples, buffer_size);
|
| @@ -467,22 +463,16 @@ index 0000000..908a498
|
| + spec->format = AUDIO_S16LSB;
|
| + spec->channels = 2;
|
| + spec->samples = _this->hidden->sample_frame_count;
|
| -+
|
| -+ SDL_LockMutex(_this->hidden->mutex);
|
| -+ _this->hidden->opened = 1;
|
| -+ SDL_UnlockMutex(_this->hidden->mutex);
|
| -+
|
| -+ // Do not create an audio thread.
|
| + return 1;
|
| +}
|
| +
|
| +} // extern "C"
|
| diff --git a/src/audio/nacl/SDL_naclaudio.h b/src/audio/nacl/SDL_naclaudio.h
|
| new file mode 100644
|
| -index 0000000..b166ab0
|
| +index 0000000..ab52848
|
| --- /dev/null
|
| +++ b/src/audio/nacl/SDL_naclaudio.h
|
| -@@ -0,0 +1,30 @@
|
| +@@ -0,0 +1,23 @@
|
| +#include "SDL_config.h"
|
| +
|
| +#ifndef _SDL_naclaudio_h
|
| @@ -500,14 +490,7 @@ index 0000000..b166ab0
|
| +#define _THIS SDL_AudioDevice *_this
|
| +
|
| +struct SDL_PrivateAudioData {
|
| -+
|
| + SDL_mutex* mutex;
|
| -+ // This flag is use to determine when the audio is opened and we can start
|
| -+ // serving audio data instead of silence. This is needed because current
|
| -+ // Pepper2 can only be used from the main thread; Therefore, we start the
|
| -+ // audio thread very early.
|
| -+ bool opened;
|
| -+
|
| + int sample_frame_count;
|
| + PP_Resource audio;
|
| +};
|
| @@ -544,7 +527,7 @@ index 5c2d81f..7a757a3 100644
|
| if ( CPU_haveCPUID() ) {
|
| diff --git a/src/main/nacl/pepper_instance.c b/src/main/nacl/pepper_instance.c
|
| new file mode 100644
|
| -index 0000000..0a3ca79
|
| +index 0000000..997e13a
|
| --- /dev/null
|
| +++ b/src/main/nacl/pepper_instance.c
|
| @@ -0,0 +1,310 @@
|
|
|