| OLD | NEW |
| (Empty) |
| 1 # NOTE: to be used with a prolog from | |
| 2 # tests/ppapi_proxy/sel_universal_ppapi_replay_prolog.stdin | |
| 3 | |
| 4 # define a bunch of variables for readability | |
| 5 set_variable MODULE i(4444) | |
| 6 set_variable INSTANCE i(5555) | |
| 7 # to be safe we allocate a shmem region of 64k | |
| 8 set_variable SHM_SIZE 65536 | |
| 9 set_variable NUM_FRAMES 4096 | |
| 10 # size of the audio buffer = NUM_FRAMES * 2 (channels) * 2 (16bit audio) | |
| 11 set_variable BUF_SIZE 16384 | |
| 12 # SHM_UNUSED = SHM_SIZE - BUF_SIZE | |
| 13 set_variable SHM_UNUSED 49152 | |
| 14 | |
| 15 # arbitrary numbers we picked as handles | |
| 16 set_variable HANDLE_CFG i(30) | |
| 17 set_variable HANDLE_AUDIO i(34) | |
| 18 | |
| 19 echo | |
| 20 echo "*** INIT MODULE" | |
| 21 # PPB_xxx replays below will be triggered as a reaction to PPP_InitializeModule | |
| 22 replay 1 PPB_GetInterface:s:i s("PPB_Core;1.0") * i(1) | |
| 23 # The results contain a process id which is non-determinisitic. | |
| 24 # We must hide the results to support golden file diffing. | |
| 25 rpc PPP_InitializeModule hide-results i(0) ${MODULE} h(pepper_desc) s("${service
_string}") * i(0) i(0) | |
| 26 | |
| 27 echo | |
| 28 echo "*** INIT INSTANCE" | |
| 29 set_variable TAGS C(10,frequency\000) | |
| 30 set_variable VALUES C(4,800\000) | |
| 31 # The PPB_xxx replays below will be triggered as a reaction to | |
| 32 # PPP_Instance_DidCreate in roughly the order shown | |
| 33 replay 1 PPB_GetInterface:s:i s("PPB_AudioConfig;1.0") * i(1) | |
| 34 replay 1 PPB_AudioConfig_RecommendSampleFrameCount:ii:i i(44100) i(${NUM_FRAMES}
) * i(${NUM_FRAMES}) | |
| 35 replay 1 PPB_AudioConfig_CreateStereo16Bit:iii:i ${INSTANCE} i(44100) i(${NUM_FR
AMES}) * ${HANDLE_CFG} | |
| 36 # TODO(robertm): explain why these are called three times | |
| 37 replay 3 PPB_Core_AddRefResource:i: ${HANDLE_CFG} * | |
| 38 replay 3 PPB_Core_ReleaseResource:i: ${HANDLE_CFG} * | |
| 39 replay 1 PPB_GetInterface:s:i s("PPB_Audio;1.0") * i(1) | |
| 40 replay 1 PPB_Audio_Create:ii:i ${INSTANCE} ${HANDLE_CFG} * ${HANDLE_AUDIO} | |
| 41 replay 1 PPB_AudioConfig_IsAudioConfig:i:i ${HANDLE_CFG} * i(1) | |
| 42 replay 1 PPB_Audio_IsAudio:i:i ${HANDLE_AUDIO} * i(1) | |
| 43 replay 1 PPB_AudioConfig_IsAudioConfig:i:i ${HANDLE_AUDIO} * i(0) | |
| 44 replay 1 PPB_Audio_IsAudio:i:i ${HANDLE_CFG} * i(0) | |
| 45 replay 1 PPB_Audio_GetCurrentConfig:i:i ${HANDLE_AUDIO} * ${HANDLE_CFG} | |
| 46 replay 1 PPB_Audio_GetCurrentConfig:i:i ${HANDLE_CFG} * i(0) | |
| 47 replay 1 PPB_AudioConfig_GetSampleRate:i:i ${HANDLE_CFG} * i(44100) | |
| 48 replay 1 PPB_AudioConfig_GetSampleFrameCount:i:i ${HANDLE_CFG} * i(${NUM_FRAMES
}) | |
| 49 replay 1 PPB_Audio_StartPlayback:i:i ${HANDLE_AUDIO} * i(1) | |
| 50 replay 1 PPB_Core_CallOnMainThread:iii: i(10000) i(1) i(0) * | |
| 51 rpc PPP_Instance_DidCreate ${INSTANCE} i(1) ${TAGS} ${VALUES} * i(0) | |
| 52 | |
| 53 echo | |
| 54 echo "*** TRIGGER REPAINT" | |
| 55 rpc PPP_Instance_DidChangeView ${INSTANCE} I(4,8,79,400,400) I(4,0,0,400,400) * | |
| 56 | |
| 57 echo | |
| 58 echo "*** SETTING UP AUDIO SHARED MEMORY" | |
| 59 shmem audio_handle audio_address ${SHM_SIZE} | |
| 60 memset ${audio_address} 0 ${SHM_SIZE} 0 | |
| 61 checksum ${audio_address} 0 ${SHM_SIZE} | |
| 62 | |
| 63 echo | |
| 64 echo "*** SETTING UP AUDIO SYNC SOCKET" | |
| 65 sync_socket_create sync_in sync_out | |
| 66 | |
| 67 echo | |
| 68 echo "*** AUDIO STREAM" | |
| 69 # inform the nexe about the shmem region and the sync_socket | |
| 70 rpc PPP_Audio_StreamCreated ${HANDLE_AUDIO} h(audio_handle) i(${BUF_SIZE}) h(syn
c_out) * | |
| 71 | |
| 72 echo | |
| 73 echo "*** AUDIO STREAM SYNC" | |
| 74 # By writing a byte into the sync sock we wake up the other side, the actual | |
| 75 # value does not matter as long as it is not -1. | |
| 76 # once the other side has woken up it is supposed to write into the buffer | |
| 77 # associated with audio_handle as quickly as possible. | |
| 78 # We wait 1sec to give it time to do that. | |
| 79 # Note: the shmem area is actually bigger than the buffer. | |
| 80 # We compute a checksum over the part that is used and that isn't. | |
| 81 # The latter checksum should not change and be zero. | |
| 82 sync_socket_write sync_in 0 | |
| 83 sleep 1 | |
| 84 checksum ${audio_address} 0 ${BUF_SIZE} | |
| 85 checksum ${audio_address} ${BUF_SIZE} ${SHM_UNUSED} | |
| 86 | |
| 87 echo | |
| 88 echo "*** AUDIO STREAM SYNC" | |
| 89 sync_socket_write sync_in 1 | |
| 90 sleep 1 | |
| 91 checksum ${audio_address} 0 ${BUF_SIZE} | |
| 92 checksum ${audio_address} ${BUF_SIZE} ${SHM_UNUSED} | |
| 93 | |
| 94 echo | |
| 95 echo "*** AUDIO STREAM SYNC" | |
| 96 sync_socket_write sync_in 2 | |
| 97 sleep 1 | |
| 98 checksum ${audio_address} 0 ${BUF_SIZE} | |
| 99 checksum ${audio_address} ${BUF_SIZE} ${SHM_UNUSED} | |
| 100 | |
| 101 echo | |
| 102 echo "*** AUDIO STREAM SYNC" | |
| 103 | |
| 104 sync_socket_write sync_in 3 | |
| 105 sleep 1 | |
| 106 checksum ${audio_address} 0 ${BUF_SIZE} | |
| 107 checksum ${audio_address} ${BUF_SIZE} ${SHM_UNUSED} | |
| 108 | |
| 109 echo | |
| 110 echo "*** TERMINATE AUDIO STREAM" | |
| 111 sync_socket_write sync_in -1 | |
| 112 checksum ${audio_address} 0 ${BUF_SIZE} | |
| 113 checksum ${audio_address} ${BUF_SIZE} 49152 | |
| 114 | |
| 115 sleep 1 | |
| 116 rpc PPP_ShutdownModule * | |
| OLD | NEW |