代码拉取完成,页面将自动刷新
同步操作将从 OpenHarmony/third_party_glib 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
diff --git a/services/engine/histreamer/player/hiplayer_callback_looper.cpp b/services/engine/histreamer/player/hiplayer_callback_looper.cpp
index 5d70e1cb..168fa52c 100755
--- a/services/engine/histreamer/player/hiplayer_callback_looper.cpp
+++ b/services/engine/histreamer/player/hiplayer_callback_looper.cpp
@@ -154,6 +154,13 @@ void HiPlayerCallbackLooper::DoReportError(const Any &error)
}
}
+void HiPlayerCallbackLooper::OnInfoDelay(PlayerOnInfoType type, int32_t extra, const Format &infoBody, long delayMs)
+{
+ eventQueue_.Enqueue(std::make_shared<HiPlayerCallbackLooper::Event>(WHAT_INFO, SteadyClock::GetCurrentTimeMs() + delayMs,
+ std::make_tuple(type, extra, infoBody)));
+}
+
+
void HiPlayerCallbackLooper::OnInfo(PlayerOnInfoType type, int32_t extra, const Format &infoBody)
{
eventQueue_.Enqueue(std::make_shared<HiPlayerCallbackLooper::Event>(WHAT_INFO, SteadyClock::GetCurrentTimeMs(),
diff --git a/services/engine/histreamer/player/hiplayer_callback_looper.h b/services/engine/histreamer/player/hiplayer_callback_looper.h
index 1dcdbd76..d6ae3d83 100755
--- a/services/engine/histreamer/player/hiplayer_callback_looper.h
+++ b/services/engine/histreamer/player/hiplayer_callback_looper.h
@@ -50,6 +50,8 @@ public:
void OnInfo(PlayerOnInfoType type, int32_t extra, const Format &infoBody) override;
+ void OnInfoDelay(PlayerOnInfoType type, int32_t extra, const Format &infoBody, long delayMs);
+
void DoReportCompletedTime();
private:
diff --git a/services/engine/histreamer/player/hiplayer_impl.cpp b/services/engine/histreamer/player/hiplayer_impl.cpp
index f790eafb..e1413a52 100644
--- a/services/engine/histreamer/player/hiplayer_impl.cpp
+++ b/services/engine/histreamer/player/hiplayer_impl.cpp
@@ -308,7 +308,11 @@ int32_t HiPlayerImpl::Play()
}
}
if (ret == MSERR_OK) {
- OnStateChanged(PlayerStateId::PLAYING);
+ if (!isInitialPlay_) {
+ OnStateChanged(PlayerStateId::PLAYING);
+ } else {
+ MEDIA_LOG_I("InitialPlay, pending to change state of playing.");
+ }
}
return ret;
}
@@ -916,7 +920,7 @@ int32_t HiPlayerImpl::GetVideoHeight()
int32_t HiPlayerImpl::SetVideoScaleType(OHOS::Media::VideoScaleType videoScaleType)
{
- MEDIA_LOG_I("SetVideoScaleType entered.");
+ MEDIA_LOG_I("SetVideoScaleType entered. VIDEO_SCALE_TYPE: " PUBLIC_LOG_D32, videoScaleType);
#ifdef SUPPORT_VIDEO
auto meta = std::make_shared<Meta>();
meta->Set<Tag::VIDEO_SCALE_TYPE>(static_cast<int32_t>(videoScaleType));
@@ -981,7 +985,9 @@ void HiPlayerImpl::OnEvent(const Event &event)
break;
}
case EventType::EVENT_AUDIO_FIRST_FRAME: {
+ MEDIA_LOG_I("audio first frame reneder received");
NotifyAudioFirstFrame(event);
+ HandleInitialPlayingStateChange(event.type);
break;
}
case EventType::EVENT_DRM_INFO_UPDATED: {
@@ -989,8 +995,10 @@ void HiPlayerImpl::OnEvent(const Event &event)
break;
}
case EventType::EVENT_VIDEO_RENDERING_START: {
+ MEDIA_LOG_I("video first frame reneder received");
Format format;
callbackLooper_.OnInfo(INFO_TYPE_MESSAGE, PlayerMessageType::PLAYER_INFO_VIDEO_RENDERING_START, format);
+ HandleInitialPlayingStateChange(event.type);
break;
}
case EventType::EVENT_AUDIO_DEVICE_CHANGE : {
@@ -1006,6 +1014,26 @@ void HiPlayerImpl::OnEvent(const Event &event)
}
}
+void HiPlayerImpl::HandleInitialPlayingStateChange(const EventType& eventType)
+{
+ for (std::pair<EventType, bool>& item : initialAVStates_) {
+ if (item.first == eventType) {
+ item.second = true;
+ }
+ }
+ for (auto item : initialAVStates_) {
+ if (item.second == false) {
+ return;
+ }
+ }
+
+ MEDIA_LOG_I("av first frame reneder all received");
+
+ isInitialPlay_ = false;
+ OnStateChanged(PlayerStateId::PLAYING);
+
+}
+
Status HiPlayerImpl::DoSetSource(const std::shared_ptr<MediaSource> source)
{
demuxer_ = FilterFactory::Instance().CreateFilter<DemuxerFilter>("builtin.player.demuxer",
@@ -1359,6 +1387,7 @@ Status HiPlayerImpl::LinkAudioSinkFilter(const std::shared_ptr<Filter>& preFilte
audioSink_->SetSyncCenter(syncManager_);
}
completeState_.emplace_back(std::make_pair("AudioSink", false));
+ initialAVStates_.emplace_back(std::make_pair(EventType::EVENT_AUDIO_FIRST_FRAME, false));
return pipeline_->LinkFilters(preFilter, {audioSink_}, type);
}
@@ -1394,6 +1423,7 @@ Status HiPlayerImpl::LinkVideoDecoderFilter(const std::shared_ptr<Filter>& preFi
}
}
completeState_.emplace_back(std::make_pair("VideoSink", false));
+ initialAVStates_.emplace_back(std::make_pair(EventType::EVENT_VIDEO_RENDERING_START, false));
return pipeline_->LinkFilters(preFilter, {videoDecoder_}, type);
}
#endif
diff --git a/services/engine/histreamer/player/hiplayer_impl.h b/services/engine/histreamer/player/hiplayer_impl.h
index ddc75d75..1ea42d7f 100644
--- a/services/engine/histreamer/player/hiplayer_impl.h
+++ b/services/engine/histreamer/player/hiplayer_impl.h
@@ -97,6 +97,7 @@ private:
Status DoSetSource(const std::shared_ptr<MediaSource> source);
Status Resume();
void HandleCompleteEvent(const Event& event);
+ void HandleInitialPlayingStateChange(const EventType& eventType);
void HandleDrmInfoUpdatedEvent(const Event& event);
void HandleIsLiveStreamEvent(bool isLiveStream);
void HandleErrorEvent(int32_t errorCode);
@@ -181,6 +182,9 @@ private:
bool stopWaitingDrmConfig_ = false;
sptr<DrmStandard::IMediaKeySessionService> keySessionServiceProxy_{nullptr};
int32_t svpMode_ = HiplayerSvpMode::SVP_CLEAR;
+
+ bool isInitialPlay_ = true;
+ std::vector<std::pair<EventType, bool>> initialAVStates_;
std::vector<std::pair<std::string, bool>> completeState_;
};
} // namespace Media
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。