auto video_cb =
became_visible ? &VideoManager::ResumeAll : &VideoManager::SuspendAll;
- // When threads are not running, it means we got no player instances.
- // No need to do anything in such case.
- if (video_thread_.IsRunning()) {
- if (!video_thread_.task_runner()->PostTask(
- FROM_HERE,
- base::BindOnce(video_cb, base::Unretained(video_manager_.get())))) {
- LOG_ID(ERROR, this)
- << "Could not post VideoManager [SuspendAll|ResumeAll] task";
- }
- } else {
- LOG_ID(INFO, this) << "Video thread is not running";
+ EnsureVideoThreadStarted();
+ if (!video_thread_.IsRunning()) {
+ LOG_ID(ERROR, this) << "Video thread is not running";
+ return;
}
- if (audio_thread_.IsRunning()) {
- if (!audio_thread_.task_runner()->PostTask(
- FROM_HERE,
- base::BindOnce(audio_cb, base::Unretained(audio_manager_.get())))) {
- LOG_ID(ERROR, this)
- << "Could not post AudioManager [SuspendAll|ResumeAll] task";
- }
- } else {
- LOG_ID(INFO, this) << "Audio thread is not running";
+ if (!video_thread_.task_runner()->PostTask(
+ FROM_HERE,
+ base::BindOnce(video_cb, base::Unretained(video_manager_.get())))) {
+ LOG_ID(ERROR, this)
+ << "Could not post VideoManager [SuspendAll|ResumeAll] task";
+ }
+
+ EnsureAudioThreadStarted();
+ if (!audio_thread_.IsRunning()) {
+ LOG_ID(ERROR, this) << "Audio thread is not running";
+ return;
+ }
+
+ if (!audio_thread_.task_runner()->PostTask(
+ FROM_HERE,
+ base::BindOnce(audio_cb, base::Unretained(audio_manager_.get())))) {
+ LOG_ID(ERROR, this)
+ << "Could not post AudioManager [SuspendAll|ResumeAll] task";
}
}
CHECK(GetPlayerState() == PlayerState::kPreparing ||
GetPlayerState() == PlayerState::kResuming);
- CHECK_PLAYER_RESULT(
- esplusplayer_set_display(player_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY,
- media::MediaPlayerEfl::main_window_handle()),
- false);
+ auto* window = media::MediaPlayerEfl::main_window_handle();
+ if (!window) {
+ SP_LOG_TYPED(ERROR)
+ << "Null window handle provided - could not further proceed "
+ "with player prepare.";
+ return false;
+ }
+
+ CHECK_PLAYER_RESULT(esplusplayer_set_display(
+ player_, ESPLUSPLAYER_DISPLAY_TYPE_OVERLAY, window),
+ false);
CHECK_PLAYER_RESULT(
esplusplayer_set_display_mode(player_, ESPLUSPLAYER_DISPLAY_MODE_DST_ROI),
false);
// According to ESPlusPlayer API documentation, setting region of interest
// needs to be performed after setting display. Setting display is being
// performed during resuming/preparing stage, so if we are currently
- // resuming/preparing, it is better to return here and wait for `StartStep()`,
- // which will update geometry.
+ // resuming/preparing, it is better to return here and wait for
+ // `StartStep()`, which will update geometry.
if (GetPlayerState() != PlayerState::kPlaying) {
SP_LOG_TYPED(INFO);
return;
// According to ESPlusPlayer API documentation, setting visibility
// needs to be performed after setting display. Setting display is being
// performed during resuming/preparing stage, so if we are currently
- // resuming/preparing, it is better to return here and wait for `StartStep()`,
- // which will update visibility.
+ // resuming/preparing, it is better to return here and wait for
+ // `StartStep()`, which will update visibility.
if (GetPlayerState() != PlayerState::kPlaying) {
SP_LOG_TYPED(INFO);
return;
return true;
}
- // According to ESPlusPlayer API description, `esplusplayer_get_adaptive_info`
- // needs to be called on prepared player.
+ // According to ESPlusPlayer API description,
+ // `esplusplayer_get_adaptive_info` needs to be called on prepared player.
if (GetPlayerState() != PlayerState::kPlaying) {
SP_LOG_TYPED(INFO)
<< "Cannot get dropped frame count of not prepared player";