client_interface_unittest.cc 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. /*
  2. * Copyright 2019 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <gtest/gtest.h>
  17. #include "client_interface.h"
  18. namespace {
  19. using ::android::hardware::bluetooth::audio::V2_0::AacObjectType;
  20. using ::android::hardware::bluetooth::audio::V2_0::AacParameters;
  21. using ::android::hardware::bluetooth::audio::V2_0::AacVariableBitRate;
  22. using ::android::hardware::bluetooth::audio::V2_0::AptxParameters;
  23. using ::android::hardware::bluetooth::audio::V2_0::CodecCapabilities;
  24. using ::android::hardware::bluetooth::audio::V2_0::CodecConfiguration;
  25. using ::android::hardware::bluetooth::audio::V2_0::CodecType;
  26. using ::android::hardware::bluetooth::audio::V2_0::LdacChannelMode;
  27. using ::android::hardware::bluetooth::audio::V2_0::LdacParameters;
  28. using ::android::hardware::bluetooth::audio::V2_0::LdacQualityIndex;
  29. using ::android::hardware::bluetooth::audio::V2_0::SbcAllocMethod;
  30. using ::android::hardware::bluetooth::audio::V2_0::SbcBlockLength;
  31. using ::android::hardware::bluetooth::audio::V2_0::SbcChannelMode;
  32. using ::android::hardware::bluetooth::audio::V2_0::SbcNumSubbands;
  33. using ::android::hardware::bluetooth::audio::V2_0::SbcParameters;
  34. using ::bluetooth::audio::AudioCapabilities;
  35. using ::bluetooth::audio::AudioConfiguration;
  36. using ::bluetooth::audio::BitsPerSample;
  37. using ::bluetooth::audio::BluetoothAudioClientInterface;
  38. using ::bluetooth::audio::BluetoothAudioStatus;
  39. using ::bluetooth::audio::ChannelMode;
  40. using ::bluetooth::audio::PcmParameters;
  41. using ::bluetooth::audio::SampleRate;
  42. using ::bluetooth::audio::SessionType;
  43. using ::testing::Test;
  44. constexpr SampleRate kSampleRates[9] = {
  45. SampleRate::RATE_UNKNOWN, SampleRate::RATE_44100, SampleRate::RATE_48000,
  46. SampleRate::RATE_88200, SampleRate::RATE_96000, SampleRate::RATE_176400,
  47. SampleRate::RATE_192000, SampleRate::RATE_16000, SampleRate::RATE_24000};
  48. constexpr BitsPerSample kBitsPerSamples[4] = {
  49. BitsPerSample::BITS_UNKNOWN, BitsPerSample::BITS_16, BitsPerSample::BITS_24,
  50. BitsPerSample::BITS_32};
  51. constexpr ChannelMode kChannelModes[3] = {
  52. ChannelMode::UNKNOWN, ChannelMode::MONO, ChannelMode::STEREO};
  53. constexpr uint16_t kPeerMtus[5] = {660, 663, 883, 1005, 1500};
  54. class TestTransport : public bluetooth::audio::IBluetoothTransportInstance {
  55. private:
  56. static constexpr uint64_t kRemoteDelayReportMs = 200;
  57. public:
  58. TestTransport(SessionType session_type)
  59. : bluetooth::audio::IBluetoothTransportInstance(session_type, {}){};
  60. bluetooth::audio::BluetoothAudioCtrlAck StartRequest() {
  61. return bluetooth::audio::BluetoothAudioCtrlAck::SUCCESS_FINISHED;
  62. }
  63. bluetooth::audio::BluetoothAudioCtrlAck SuspendRequest() {
  64. return bluetooth::audio::BluetoothAudioCtrlAck::SUCCESS_FINISHED;
  65. }
  66. void StopRequest() {}
  67. bool GetPresentationPosition(uint64_t* remote_delay_report_ns,
  68. uint64_t* total_bytes_readed,
  69. timespec* data_position) {
  70. if (remote_delay_report_ns) {
  71. *remote_delay_report_ns = kRemoteDelayReportMs * 1000000;
  72. }
  73. if (total_bytes_readed) {
  74. *total_bytes_readed = 0;
  75. }
  76. if (data_position) {
  77. clock_gettime(CLOCK_MONOTONIC, data_position);
  78. }
  79. return true;
  80. }
  81. void MetadataChanged(const source_metadata_t& source_metadata __unused) {}
  82. void ResetPresentationPosition(){};
  83. void LogBytesRead(size_t bytes_readed __unused){};
  84. };
  85. class BluetoothAudioClientInterfaceTest : public Test {
  86. protected:
  87. TestTransport* test_transport_;
  88. BluetoothAudioClientInterface* clientif_;
  89. static constexpr int kClientIfReturnSuccess = 0;
  90. virtual void SetUp() override {}
  91. virtual void TearDown() override {
  92. clientif_ = nullptr;
  93. test_transport_ = nullptr;
  94. }
  95. bool IsSoftwarePcmParametersSupported(const PcmParameters& pcm_config) {
  96. const std::vector<AudioCapabilities>& capabilities =
  97. clientif_->GetAudioCapabilities();
  98. PcmParameters pcm_capabilities = capabilities[0].pcmCapabilities();
  99. bool is_pcm_config_valid =
  100. (pcm_config.sampleRate != SampleRate::RATE_UNKNOWN &&
  101. pcm_config.bitsPerSample != BitsPerSample::BITS_UNKNOWN &&
  102. pcm_config.channelMode != ChannelMode::UNKNOWN);
  103. bool is_pcm_config_supported =
  104. (pcm_config.sampleRate & pcm_capabilities.sampleRate &&
  105. pcm_config.bitsPerSample & pcm_capabilities.bitsPerSample &&
  106. pcm_config.channelMode & pcm_capabilities.channelMode);
  107. return (is_pcm_config_valid && is_pcm_config_supported);
  108. }
  109. bool IsOffloadCodecConfigurationSupported(
  110. const CodecConfiguration& codec_config) {
  111. CodecCapabilities codec_capability = {};
  112. for (auto audio_capability : clientif_->GetAudioCapabilities()) {
  113. if (audio_capability.codecCapabilities().codecType ==
  114. codec_config.codecType) {
  115. codec_capability = audio_capability.codecCapabilities();
  116. }
  117. }
  118. if (codec_capability.codecType != codec_config.codecType) {
  119. // codec is unsupported
  120. return false;
  121. }
  122. bool is_codec_config_supported = false;
  123. switch (codec_config.codecType) {
  124. case CodecType::SBC: {
  125. SbcParameters sbc_config = codec_config.config.sbcConfig();
  126. SbcParameters sbc_capability =
  127. codec_capability.capabilities.sbcCapabilities();
  128. is_codec_config_supported =
  129. (sbc_config.sampleRate & sbc_capability.sampleRate &&
  130. sbc_config.channelMode & sbc_capability.channelMode &&
  131. sbc_config.blockLength & sbc_capability.blockLength &&
  132. sbc_config.numSubbands & sbc_capability.numSubbands &&
  133. sbc_config.allocMethod & sbc_capability.allocMethod &&
  134. sbc_config.bitsPerSample & sbc_capability.bitsPerSample &&
  135. (sbc_capability.minBitpool <= sbc_config.minBitpool &&
  136. sbc_config.minBitpool <= sbc_config.maxBitpool &&
  137. sbc_config.maxBitpool <= sbc_capability.maxBitpool));
  138. return is_codec_config_supported;
  139. }
  140. case CodecType::AAC: {
  141. AacParameters aac_config = codec_config.config.aacConfig();
  142. AacParameters aac_capability =
  143. codec_capability.capabilities.aacCapabilities();
  144. is_codec_config_supported =
  145. (aac_config.objectType & aac_capability.objectType &&
  146. aac_config.sampleRate & aac_capability.sampleRate &&
  147. aac_config.channelMode & aac_capability.channelMode &&
  148. (aac_config.variableBitRateEnabled ==
  149. AacVariableBitRate::DISABLED ||
  150. aac_capability.variableBitRateEnabled ==
  151. AacVariableBitRate::ENABLED) &&
  152. aac_config.bitsPerSample & aac_capability.bitsPerSample);
  153. return is_codec_config_supported;
  154. }
  155. case CodecType::LDAC: {
  156. LdacParameters ldac_config = codec_config.config.ldacConfig();
  157. LdacParameters ldac_capability =
  158. codec_capability.capabilities.ldacCapabilities();
  159. is_codec_config_supported =
  160. (ldac_config.sampleRate & ldac_capability.sampleRate &&
  161. ldac_config.channelMode & ldac_capability.channelMode &&
  162. ldac_config.bitsPerSample & ldac_capability.bitsPerSample);
  163. return is_codec_config_supported;
  164. }
  165. case CodecType::APTX:
  166. [[fallthrough]];
  167. case CodecType::APTX_HD: {
  168. AptxParameters aptx_config = codec_config.config.aptxConfig();
  169. AptxParameters aptx_capability =
  170. codec_capability.capabilities.aptxCapabilities();
  171. is_codec_config_supported =
  172. (aptx_config.sampleRate & aptx_capability.sampleRate &&
  173. aptx_config.channelMode & aptx_capability.channelMode &&
  174. aptx_config.bitsPerSample & aptx_capability.bitsPerSample);
  175. return is_codec_config_supported;
  176. }
  177. case CodecType::UNKNOWN:
  178. return false;
  179. }
  180. }
  181. };
  182. } // namespace
  183. TEST_F(BluetoothAudioClientInterfaceTest, StartAndEndA2dpSoftwareSession) {
  184. test_transport_ =
  185. new TestTransport(SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH);
  186. clientif_ = new BluetoothAudioClientInterface(test_transport_, nullptr);
  187. AudioConfiguration audio_config = {};
  188. PcmParameters pcm_config = {};
  189. for (auto sample_rate : kSampleRates) {
  190. pcm_config.sampleRate = sample_rate;
  191. for (auto bits_per_sample : kBitsPerSamples) {
  192. pcm_config.bitsPerSample = bits_per_sample;
  193. for (auto channel_mode : kChannelModes) {
  194. pcm_config.channelMode = channel_mode;
  195. audio_config.pcmConfig(pcm_config);
  196. clientif_->UpdateAudioConfig(audio_config);
  197. if (IsSoftwarePcmParametersSupported(pcm_config)) {
  198. EXPECT_EQ(clientif_->StartSession(), kClientIfReturnSuccess);
  199. } else {
  200. EXPECT_NE(clientif_->StartSession(), kClientIfReturnSuccess);
  201. }
  202. EXPECT_EQ(clientif_->EndSession(), kClientIfReturnSuccess);
  203. } // ChannelMode
  204. } // BitsPerSampple
  205. } // SampleRate
  206. }
  207. TEST_F(BluetoothAudioClientInterfaceTest, StartAndEndA2dpOffloadSbcSession) {
  208. test_transport_ =
  209. new TestTransport(SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH);
  210. clientif_ = new BluetoothAudioClientInterface(test_transport_, nullptr);
  211. AudioConfiguration audio_config = {};
  212. CodecConfiguration codec_config = {};
  213. SbcBlockLength block_lengths[4] = {
  214. SbcBlockLength::BLOCKS_4, SbcBlockLength::BLOCKS_8,
  215. SbcBlockLength::BLOCKS_12, SbcBlockLength::BLOCKS_16};
  216. SbcNumSubbands num_subbands[2] = {SbcNumSubbands::SUBBAND_4,
  217. SbcNumSubbands::SUBBAND_8};
  218. SbcAllocMethod alloc_methods[2] = {SbcAllocMethod::ALLOC_MD_S,
  219. SbcAllocMethod::ALLOC_MD_L};
  220. for (auto sample_rate : kSampleRates) {
  221. for (auto bits_per_sample : kBitsPerSamples) {
  222. for (auto channel_mode : kChannelModes) {
  223. for (auto peer_mtu : kPeerMtus) {
  224. for (auto block_length : block_lengths) {
  225. for (auto num_subband : num_subbands) {
  226. for (auto alloc_method : alloc_methods) {
  227. codec_config.codecType = CodecType::SBC;
  228. codec_config.peerMtu = peer_mtu;
  229. codec_config.isScmstEnabled = false;
  230. // A2DP_SBC_DEFAULT_BITRATE
  231. codec_config.encodedAudioBitrate = 328000;
  232. SbcParameters sbc = {
  233. .sampleRate = sample_rate,
  234. .channelMode = (channel_mode == ChannelMode::MONO
  235. ? SbcChannelMode::MONO
  236. : SbcChannelMode::JOINT_STEREO),
  237. .blockLength = block_length,
  238. .numSubbands = num_subband,
  239. .allocMethod = alloc_method,
  240. .bitsPerSample = bits_per_sample,
  241. .minBitpool = 2,
  242. .maxBitpool = 53};
  243. codec_config.config.sbcConfig(sbc);
  244. audio_config.codecConfig(codec_config);
  245. clientif_->UpdateAudioConfig(audio_config);
  246. if (IsOffloadCodecConfigurationSupported(codec_config)) {
  247. EXPECT_EQ(clientif_->StartSession(), kClientIfReturnSuccess);
  248. } else {
  249. EXPECT_NE(clientif_->StartSession(), kClientIfReturnSuccess);
  250. }
  251. EXPECT_EQ(clientif_->EndSession(), kClientIfReturnSuccess);
  252. } // SbcAllocMethod
  253. } // SbcNumSubbands
  254. } // SbcBlockLength
  255. } // peerMtu
  256. } // ChannelMode
  257. } // BitsPerSampple
  258. } // SampleRate
  259. }
  260. TEST_F(BluetoothAudioClientInterfaceTest, StartAndEndA2dpOffloadAacSession) {
  261. test_transport_ =
  262. new TestTransport(SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH);
  263. clientif_ = new BluetoothAudioClientInterface(test_transport_, nullptr);
  264. AudioConfiguration audio_config = {};
  265. CodecConfiguration codec_config = {};
  266. AacObjectType object_types[4] = {
  267. AacObjectType::MPEG2_LC, AacObjectType::MPEG4_LC,
  268. AacObjectType::MPEG4_LTP, AacObjectType::MPEG4_SCALABLE};
  269. AacVariableBitRate variable_bitrates[2] = {AacVariableBitRate::DISABLED,
  270. AacVariableBitRate::ENABLED};
  271. for (auto sample_rate : kSampleRates) {
  272. for (auto bits_per_sample : kBitsPerSamples) {
  273. for (auto channel_mode : kChannelModes) {
  274. for (auto peer_mtu : kPeerMtus) {
  275. for (auto object_type : object_types) {
  276. for (auto variable_bitrate : variable_bitrates) {
  277. codec_config.codecType = CodecType::AAC;
  278. codec_config.peerMtu = peer_mtu;
  279. codec_config.isScmstEnabled = false;
  280. // A2DP_AAC_DEFAULT_BITRATE
  281. codec_config.encodedAudioBitrate = 320000;
  282. AacParameters aac = {.objectType = object_type,
  283. .sampleRate = sample_rate,
  284. .channelMode = channel_mode,
  285. .variableBitRateEnabled = variable_bitrate,
  286. .bitsPerSample = bits_per_sample};
  287. codec_config.config.aacConfig(aac);
  288. audio_config.codecConfig(codec_config);
  289. clientif_->UpdateAudioConfig(audio_config);
  290. if (IsOffloadCodecConfigurationSupported(codec_config)) {
  291. EXPECT_EQ(clientif_->StartSession(), kClientIfReturnSuccess);
  292. } else {
  293. EXPECT_NE(clientif_->StartSession(), kClientIfReturnSuccess);
  294. }
  295. EXPECT_EQ(clientif_->EndSession(), kClientIfReturnSuccess);
  296. } // AacVariableBitRate
  297. } // AacObjectType
  298. } // peerMtu
  299. } // ChannelMode
  300. } // BitsPerSampple
  301. } // SampleRate
  302. }
  303. TEST_F(BluetoothAudioClientInterfaceTest, StartAndEndA2dpOffloadLdacSession) {
  304. test_transport_ =
  305. new TestTransport(SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH);
  306. clientif_ = new BluetoothAudioClientInterface(test_transport_, nullptr);
  307. AudioConfiguration audio_config = {};
  308. CodecConfiguration codec_config = {};
  309. LdacQualityIndex quality_indexes[4] = {
  310. LdacQualityIndex::QUALITY_HIGH, LdacQualityIndex::QUALITY_MID,
  311. LdacQualityIndex::QUALITY_LOW, LdacQualityIndex::QUALITY_ABR};
  312. for (auto sample_rate : kSampleRates) {
  313. for (auto bits_per_sample : kBitsPerSamples) {
  314. for (auto channel_mode : kChannelModes) {
  315. for (auto peer_mtu : kPeerMtus) {
  316. for (auto quality_index : quality_indexes) {
  317. codec_config.codecType = CodecType::LDAC;
  318. codec_config.peerMtu = peer_mtu;
  319. codec_config.isScmstEnabled = false;
  320. codec_config.encodedAudioBitrate = 990000;
  321. LdacParameters ldac = {
  322. .sampleRate = sample_rate,
  323. .channelMode = (channel_mode == ChannelMode::MONO
  324. ? LdacChannelMode::MONO
  325. : LdacChannelMode::STEREO),
  326. .qualityIndex = quality_index,
  327. .bitsPerSample = bits_per_sample};
  328. codec_config.config.ldacConfig(ldac);
  329. audio_config.codecConfig(codec_config);
  330. clientif_->UpdateAudioConfig(audio_config);
  331. if (IsOffloadCodecConfigurationSupported(codec_config)) {
  332. EXPECT_EQ(clientif_->StartSession(), kClientIfReturnSuccess);
  333. } else {
  334. EXPECT_NE(clientif_->StartSession(), kClientIfReturnSuccess);
  335. }
  336. EXPECT_EQ(clientif_->EndSession(), kClientIfReturnSuccess);
  337. } // LdacQualityIndex
  338. } // peerMtu
  339. } // ChannelMode
  340. } // BitsPerSampple
  341. } // SampleRate
  342. }
  343. TEST_F(BluetoothAudioClientInterfaceTest, StartAndEndA2dpOffloadAptxSession) {
  344. test_transport_ =
  345. new TestTransport(SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH);
  346. clientif_ = new BluetoothAudioClientInterface(test_transport_, nullptr);
  347. AudioConfiguration audio_config = {};
  348. CodecConfiguration codec_config = {};
  349. for (auto sample_rate : kSampleRates) {
  350. for (auto bits_per_sample : kBitsPerSamples) {
  351. for (auto channel_mode : kChannelModes) {
  352. for (auto peer_mtu : kPeerMtus) {
  353. codec_config.codecType = CodecType::APTX;
  354. codec_config.peerMtu = peer_mtu;
  355. codec_config.isScmstEnabled = false;
  356. codec_config.encodedAudioBitrate = 352000;
  357. AptxParameters aptx = {.sampleRate = sample_rate,
  358. .channelMode = channel_mode,
  359. .bitsPerSample = bits_per_sample};
  360. codec_config.config.aptxConfig(aptx);
  361. audio_config.codecConfig(codec_config);
  362. clientif_->UpdateAudioConfig(audio_config);
  363. if (IsOffloadCodecConfigurationSupported(codec_config)) {
  364. EXPECT_EQ(clientif_->StartSession(), kClientIfReturnSuccess);
  365. } else {
  366. EXPECT_NE(clientif_->StartSession(), kClientIfReturnSuccess);
  367. }
  368. EXPECT_EQ(clientif_->EndSession(), kClientIfReturnSuccess);
  369. } // peerMtu
  370. } // ChannelMode
  371. } // BitsPerSampple
  372. } // SampleRate
  373. }
  374. TEST_F(BluetoothAudioClientInterfaceTest, StartAndEndA2dpOffloadAptxHdSession) {
  375. test_transport_ =
  376. new TestTransport(SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH);
  377. clientif_ = new BluetoothAudioClientInterface(test_transport_, nullptr);
  378. AudioConfiguration audio_config = {};
  379. CodecConfiguration codec_config = {};
  380. for (auto sample_rate : kSampleRates) {
  381. for (auto bits_per_sample : kBitsPerSamples) {
  382. for (auto channel_mode : kChannelModes) {
  383. for (auto peer_mtu : kPeerMtus) {
  384. codec_config.codecType = CodecType::APTX_HD;
  385. codec_config.peerMtu = peer_mtu;
  386. codec_config.isScmstEnabled = false;
  387. codec_config.encodedAudioBitrate = 576000;
  388. AptxParameters aptx = {.sampleRate = sample_rate,
  389. .channelMode = channel_mode,
  390. .bitsPerSample = bits_per_sample};
  391. codec_config.config.aptxConfig(aptx);
  392. audio_config.codecConfig(codec_config);
  393. clientif_->UpdateAudioConfig(audio_config);
  394. if (IsOffloadCodecConfigurationSupported(codec_config)) {
  395. EXPECT_EQ(clientif_->StartSession(), kClientIfReturnSuccess);
  396. } else {
  397. EXPECT_NE(clientif_->StartSession(), kClientIfReturnSuccess);
  398. }
  399. EXPECT_EQ(clientif_->EndSession(), kClientIfReturnSuccess);
  400. } // peerMtu
  401. } // ChannelMode
  402. } // BitsPerSampple
  403. } // SampleRate
  404. }
  405. TEST_F(BluetoothAudioClientInterfaceTest,
  406. StartAndEndA2dpOffloadUnknownSession) {
  407. test_transport_ =
  408. new TestTransport(SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH);
  409. clientif_ = new BluetoothAudioClientInterface(test_transport_, nullptr);
  410. AudioConfiguration audio_config = {};
  411. CodecConfiguration codec_config = {};
  412. codec_config.codecType = CodecType::UNKNOWN;
  413. codec_config.peerMtu = 1005;
  414. codec_config.isScmstEnabled = false;
  415. codec_config.encodedAudioBitrate = 328000;
  416. codec_config.config = {};
  417. audio_config.codecConfig(codec_config);
  418. clientif_->UpdateAudioConfig(audio_config);
  419. if (IsOffloadCodecConfigurationSupported(codec_config)) {
  420. EXPECT_EQ(clientif_->StartSession(), kClientIfReturnSuccess);
  421. } else {
  422. EXPECT_NE(clientif_->StartSession(), kClientIfReturnSuccess);
  423. }
  424. EXPECT_EQ(clientif_->EndSession(), kClientIfReturnSuccess);
  425. }
  426. TEST_F(BluetoothAudioClientInterfaceTest,
  427. StartAndEndHearingAidSoftwareSession) {
  428. test_transport_ =
  429. new TestTransport(SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH);
  430. clientif_ = new BluetoothAudioClientInterface(test_transport_, nullptr);
  431. AudioConfiguration audio_config = {};
  432. PcmParameters pcm_config = {};
  433. for (auto sample_rate : kSampleRates) {
  434. pcm_config.sampleRate = sample_rate;
  435. for (auto bits_per_sample : kBitsPerSamples) {
  436. pcm_config.bitsPerSample = bits_per_sample;
  437. for (auto channel_mode : kChannelModes) {
  438. pcm_config.channelMode = channel_mode;
  439. audio_config.pcmConfig(pcm_config);
  440. clientif_->UpdateAudioConfig(audio_config);
  441. if (IsSoftwarePcmParametersSupported(pcm_config)) {
  442. EXPECT_EQ(clientif_->StartSession(), kClientIfReturnSuccess);
  443. } else {
  444. EXPECT_NE(clientif_->StartSession(), kClientIfReturnSuccess);
  445. }
  446. EXPECT_EQ(clientif_->EndSession(), kClientIfReturnSuccess);
  447. } // ChannelMode
  448. } // BitsPerSampple
  449. } // SampleRate
  450. }