FIX: [STUDIO-2340] [STUDIO-2297] handle linux gstreamer error

Change-Id: Iadc6dcb9d7a9f2c5d1ce9cf979bbbfbd0f805d19
This commit is contained in:
chunmao.guo 2023-03-06 16:02:57 +08:00 committed by Lane.Wei
parent 0e3364a415
commit a401c0fa2e
4 changed files with 37 additions and 10 deletions

View file

@ -27,9 +27,6 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w
{
SetBackgroundColour(*wxWHITE);
m_media_ctrl->Bind(wxEVT_MEDIA_STATECHANGED, &MediaPlayCtrl::onStateChanged, this);
#if wxUSE_GSTREAMER_PLAYER
m_media_ctrl->Bind(wxEVT_MEDIA_LOADED, &MediaPlayCtrl::onStateChanged, this);
#endif
m_button_play = new Button(this, "", "media_play", wxBORDER_NONE);
m_button_play->SetCanFocus(false);
@ -365,11 +362,11 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent &event)
Stop();
return;
}
if (last_state == MEDIASTATE_LOADING && (state == wxMEDIASTATE_STOPPED || state == wxMEDIASTATE_PAUSED || event.GetEventType() == wxEVT_MEDIA_LOADED)) {
if (last_state == MEDIASTATE_LOADING && (state == wxMEDIASTATE_STOPPED || state == wxMEDIASTATE_PAUSED)) {
wxSize size = m_media_ctrl->GetVideoSize();
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::onStateChanged: size: " << size.x << "x" << size.y;
m_failed_code = m_media_ctrl->GetLastError();
if (size.GetWidth() > 1000 || (event.GetEventType() == wxEVT_MEDIA_LOADED)) {
if (size.GetWidth() > 1000) {
m_last_state = state;
SetStatus(_L("Playing..."), false);
m_failed_retry = 0;