fixup! [HBBTV] Redundant MMPlayer API usage when resuming video playback after pause. 28/316928/2
authorKajetan Brzuszczak <k.brzuszczak@partner.samsung.com>
Wed, 28 Aug 2024 07:15:53 +0000 (09:15 +0200)
committerj.gajownik2 <j.gajownik2@samsung.com>
Fri, 30 Aug 2024 09:13:02 +0000 (11:13 +0200)
The SelectAudioTrack method selected an old track instead, the one
  which was requested.

Bug: https://jira-eu.sec.samsung.net/browse/VDSPD2CA-1209
Signed-off-by: Kajetan Brzuszczak <k.brzuszczak@partner.samsung.com>
Change-Id: Ib9bdddde267faba21b467f6bd477e54dd8fc52b4

tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc

index 23fe9650b2e9263b6b733ce85d029cc78ca7d3f0..3458211f8e9915c19b2c9c1db93dbae80a0cd47e 100644 (file)
@@ -3266,33 +3266,38 @@ void MediaPlayerBridgeCapiTV::UpdatePreferAudio() {
 bool MediaPlayerBridgeCapiTV::SelectAudioTrack(int audio_track_id) {
   constexpr int kAdapationSetNotCare{-1};
 
-  int active_audio_track = 0;
+  int current_active_audio_track_id = 0;
   int active_alternative_set = 0;
 
   auto ret = player_get_current_track_ex(player_, PLAYER_STREAM_TYPE_AUDIO,
-    &active_audio_track, &active_alternative_set);
+    &current_active_audio_track_id, &active_alternative_set);
 
   if (ret != PLAYER_ERROR_NONE) {
     LOG(ERROR) << "player_get_current_track_ex fail, ret val = " << ret;
     return false;
   }
 
-  if (active_audio_track == audio_track_id) {
+  if (current_active_audio_track_id != active_audio_track_id_) {
+    LOG(WARNING) << "Current audio track is different from the stored one";
+    active_audio_track_id_ = current_active_audio_track_id;
+  }
+
+  if (current_active_audio_track_id == audio_track_id) {
     return true;
   }
 
   LOG(INFO) << "Updating active_audio_track_id_=" << active_audio_track_id_
-    << " to new value active_audio_track=" << active_audio_track;
+    << " to audio_track_id=" << audio_track_id;
 
   ret = player_select_track_ex(player_, PLAYER_STREAM_TYPE_AUDIO,
-    active_audio_track_id_, kAdapationSetNotCare);
+    audio_track_id, kAdapationSetNotCare);
 
   if (ret != PLAYER_ERROR_NONE) {
     LOG(ERROR) << "player_select_track_ex fail, ret val = " << ret;
     return false;
   }
 
-  active_audio_track_id_ = active_audio_track;
+  active_audio_track_id_ = audio_track_id;
 
   return true;
 }