OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PAPPI_TESTS_TEST_AUDIO_H_ | 5 #ifndef PAPPI_TESTS_TEST_AUDIO_H_ |
6 #define PAPPI_TESTS_TEST_AUDIO_H_ | 6 #define PAPPI_TESTS_TEST_AUDIO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ppapi/c/ppb_audio.h" | 10 #include "ppapi/c/ppb_audio.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 virtual bool Init(); | 21 virtual bool Init(); |
22 virtual void RunTests(const std::string& filter); | 22 virtual void RunTests(const std::string& filter); |
23 | 23 |
24 private: | 24 private: |
25 std::string TestCreation(); | 25 std::string TestCreation(); |
26 std::string TestDestroyNoStop(); | 26 std::string TestDestroyNoStop(); |
27 std::string TestFailures(); | 27 std::string TestFailures(); |
28 std::string TestAudioCallback1(); | 28 std::string TestAudioCallback1(); |
29 std::string TestAudioCallback2(); | 29 std::string TestAudioCallback2(); |
30 std::string TestAudioCallback3(); | 30 std::string TestAudioCallback3(); |
| 31 std::string TestAudioCallback4(); |
31 | 32 |
32 // Calls |audio_callback_method_| (where |user_data| is "this"). | 33 // Calls |audio_callback_method_| (where |user_data| is "this"). |
33 static void AudioCallbackTrampoline(void* sample_buffer, | 34 static void AudioCallbackTrampoline(void* sample_buffer, |
34 uint32_t buffer_size_in_bytes, | 35 uint32_t buffer_size_in_bytes, |
| 36 PP_TimeDelta latency, |
35 void* user_data); | 37 void* user_data); |
| 38 static void AudioCallbackTrampoline1_0(void* sample_buffer, |
| 39 uint32_t buffer_size_in_bytes, |
| 40 void* user_data); |
36 | 41 |
37 typedef void (TestAudio::*AudioCallbackMethod)(void* sample_buffer, | 42 typedef void (TestAudio::*AudioCallbackMethod)(void* sample_buffer, |
38 uint32_t buffer_size_in_bytes); | 43 uint32_t buffer_size_in_bytes, |
| 44 PP_TimeDelta latency); |
39 | 45 |
40 // Method called by |AudioCallbackTrampoline()|. Set only when the callback | 46 // Method called by |AudioCallbackTrampoline()|. Set only when the callback |
41 // can't be running (before |StartPlayback()|, after |StopPlayback()| or | 47 // can't be running (before |StartPlayback()|, after |StopPlayback()| or |
42 // releasing the last reference to the audio resource). | 48 // releasing the last reference to the audio resource). |
43 AudioCallbackMethod audio_callback_method_; | 49 AudioCallbackMethod audio_callback_method_; |
44 | 50 |
45 // An |AudioCallbackMethod| that just clears |sample_buffer|. | 51 // An |AudioCallbackMethod| that just clears |sample_buffer|. |
46 void AudioCallbackTrivial(void* sample_buffer, uint32_t buffer_size_in_bytes); | 52 void AudioCallbackTrivial(void* sample_buffer, |
| 53 uint32_t buffer_size_in_bytes, |
| 54 PP_TimeDelta latency); |
47 | 55 |
48 // |AudioCallbackMethod| used by |TestAudioCallbackN()|. | 56 // |AudioCallbackMethod| used by |TestAudioCallbackN()|. |
49 void AudioCallbackTest(void* sample_buffer, uint32_t buffer_size_in_bytes); | 57 void AudioCallbackTest(void* sample_buffer, |
| 58 uint32_t buffer_size_in_bytes, |
| 59 PP_TimeDelta latency); |
| 60 |
| 61 PP_Resource CreateAudioConfig(PP_AudioSampleRate sample_rate, |
| 62 uint32_t requested_sample_frame_count); |
50 | 63 |
51 // Used by |TestAudioCallbackN()|. | 64 // Used by |TestAudioCallbackN()|. |
52 NestedEvent audio_callback_event_; | 65 NestedEvent audio_callback_event_; |
53 | 66 |
54 bool test_done_; | 67 bool test_done_; |
55 bool callback_fired_; | |
56 | 68 |
57 // Raw C-level interfaces, set in |Init()|; do not modify them elsewhere. | 69 // Raw C-level interfaces, set in |Init()|; do not modify them elsewhere. |
58 const PPB_Audio* audio_interface_; | 70 const PPB_Audio_1_1* audio_interface_; |
| 71 const PPB_Audio_1_0* audio_interface_1_0_; |
59 const PPB_AudioConfig* audio_config_interface_; | 72 const PPB_AudioConfig* audio_config_interface_; |
60 const PPB_Core* core_interface_; | 73 const PPB_Core* core_interface_; |
61 }; | 74 }; |
62 | 75 |
63 #endif // PAPPI_TESTS_TEST_AUDIO_H_ | 76 #endif // PAPPI_TESTS_TEST_AUDIO_H_ |
OLD | NEW |