add tc for other pcm pipeline
authorjk0716-hwang <jk0716.hwang@samsung.com>
Wed, 29 Nov 2023 03:18:01 +0000 (03:18 +0000)
committerjk0716-hwang <jk0716.hwang@samsung.com>
Wed, 29 Nov 2023 03:18:01 +0000 (03:18 +0000)
ut/src/esplusplayer/ut_low_latency_pcm.cpp

index 1db50dff706e1c18ee6cde4a546a4d038d4ce34d..616e460a5834a7e5e92d52c0a448a22d529f2519 100644 (file)
@@ -191,5 +191,75 @@ TEST_P(EsPcmTest, vdapi_basic_esplusplayer_pcm_start_p_1) {
   std::cout << "PcmTest, Play, END" << std::endl;
 }
 
+TEST_P(EsPcmTest,
+       vdapi_basic_esplusplayer_get_low_latency_pcm_buffer_size_n_1) {
+  // mmpcmsink pipeline + no low latency
+  ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
+  SetAppInfo(esplayer_);
+  ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
+  ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
+            ESPLUSPLAYER_ERROR_TYPE_NONE);
+  callback_->WaitForPrepareDone();
+
+  uint64_t frame_count = 0;
+  ASSERT_EQ(
+      esplusplayer_get_low_latency_pcm_buffer_size(esplayer_, &frame_count),
+      ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
+}
+
+TEST_P(EsPcmTest,
+       vdapi_basic_esplusplayer_get_low_latency_pcm_buffer_size_n_2) {
+  //for game : omx+mmaudiosink pipeline
+  ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
+  ASSERT_EQ(esplusplayer_set_low_latency_mode(
+                esplayer_, ESPLUSPLAYER_LOW_LATENCY_MODE_ENABLE_GAME_MODE),
+            ESPLUSPLAYER_ERROR_TYPE_NONE);
+  ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
+  ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
+            ESPLUSPLAYER_ERROR_TYPE_NONE);
+  callback_->WaitForPrepareDone();
+  uint64_t frame_count = 0;
+  ASSERT_EQ(
+      esplusplayer_get_low_latency_pcm_buffer_size(esplayer_, &frame_count),
+      ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
+}
+
+TEST_P(EsPcmTest,
+       vdapi_basic_esplusplayer_get_low_latency_pcm_buffer_size_n_3) {
+  //for free-run : omx+mmaudiosink pipeline
+  ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
+  ASSERT_EQ(esplusplayer_set_low_latency_mode(
+                esplayer_, ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_SYNC),
+            ESPLUSPLAYER_ERROR_TYPE_NONE);
+  ASSERT_EQ(esplusplayer_set_low_latency_mode(
+                esplayer_, ESPLUSPLAYER_LOW_LATENCY_MODE_AUDIO),
+            ESPLUSPLAYER_ERROR_TYPE_NONE);
+  ASSERT_EQ(esplusplayer_set_low_latency_mode(
+                esplayer_, ESPLUSPLAYER_LOW_LATENCY_MODE_VIDEO),
+            ESPLUSPLAYER_ERROR_TYPE_NONE);
+  ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
+  ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
+            ESPLUSPLAYER_ERROR_TYPE_NONE);
+  callback_->WaitForPrepareDone();
+  uint64_t frame_count = 0;
+  ASSERT_EQ(
+      esplusplayer_get_low_latency_pcm_buffer_size(esplayer_, &frame_count),
+      ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
+}
+
+TEST_P(EsPcmTest,
+       vdapi_basic_esplusplayer_get_low_latency_pcm_buffer_size_n_4) {
+  //for normal : alsasink-tv
+  ASSERT_EQ(esplusplayer_open(esplayer_), ESPLUSPLAYER_ERROR_TYPE_NONE);
+  ASSERT_TRUE(audio_reader_->SetStreamInfo(esplayer_));
+  ASSERT_EQ(esplusplayer_prepare_async(esplayer_),
+            ESPLUSPLAYER_ERROR_TYPE_NONE);
+  callback_->WaitForPrepareDone();
+  uint64_t frame_count = 0;
+  ASSERT_EQ(
+      esplusplayer_get_low_latency_pcm_buffer_size(esplayer_, &frame_count),
+      ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION);
+}
+
 INSTANTIATE_TEST_CASE_P(ESPlusplayer, EsPcmTest,
                         ::testing::ValuesIn(es_tc::pcm_tc_list));