Skip to content
This repository
Browse code

[omxplayer] fixed wait on omx completition to ensure all data is rend…

…ered and added a debug log message to see if we hit EOS.
  • Loading branch information...
commit fae30c3a101da8a0a121d07b736d7a6f4fc6d5c9 1 parent 4e02fe9
huceke authored October 14, 2012
3  xbmc/cores/omxplayer/OMXAudio.cpp
@@ -1180,7 +1180,10 @@ void COMXAudio::WaitCompletion()
1180 1180
   while(nTimeOut)
1181 1181
   {
1182 1182
     if(m_omx_render->IsEOS())
  1183
+    {
  1184
+      CLog::Log(LOGDEBUG, "%s::%s - got eos\n", CLASSNAME, __func__);
1183 1185
       break;
  1186
+    }
1184 1187
 
1185 1188
     if(nTimeOut == 0)
1186 1189
     {
12  xbmc/cores/omxplayer/OMXPlayer.cpp
@@ -1244,6 +1244,18 @@ void COMXPlayer::Process()
1244 1244
           continue;
1245 1245
         }
1246 1246
 
  1247
+        // wait for omx components to fimish
  1248
+        if(HasVideo() && !m_player_video.IsEOS())
  1249
+        {
  1250
+          Sleep(100);
  1251
+          continue;
  1252
+        }
  1253
+        if(HasAudio() && !m_player_audio.IsEOS())
  1254
+        {
  1255
+          Sleep(100);
  1256
+          continue;
  1257
+        }
  1258
+
1247 1259
         if (!m_pInputStream->IsEOF())
1248 1260
           CLog::Log(LOGINFO, "%s - eof reading from demuxer", __FUNCTION__);
1249 1261
 
6  xbmc/cores/omxplayer/OMXPlayerAudio.cpp
@@ -78,6 +78,7 @@ OMXPlayerAudio::OMXPlayerAudio(OMXClock *av_clock,
78 78
   m_nChannels     = 0;
79 79
   m_DecoderOpen   = false;
80 80
   m_freq          = CurrentHostFrequency();
  81
+  m_send_eos      = false;
81 82
   m_hints_current.Clear();
82 83
 
83 84
   m_av_clock->SetMasterClock(false);
@@ -150,6 +151,7 @@ void OMXPlayerAudio::OpenStream(CDVDStreamInfo &hints, COMXAudioCodecOMX *codec)
150 151
   m_stalled         = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0;
151 152
   m_use_passthrough = (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_HDMI) ? true : false ;
152 153
   m_use_hw_decode   = g_advancedSettings.m_omxHWAudioDecode;
  154
+  m_send_eos        = false;
153 155
 }
154 156
 
155 157
 bool OMXPlayerAudio::CloseStream(bool bWaitForBuffers)
@@ -775,7 +777,9 @@ double OMXPlayerAudio::GetCacheTime()
775 777
 
776 778
 void OMXPlayerAudio::WaitCompletion()
777 779
 {
778  
-  m_omxAudio.WaitCompletion();
  780
+  if(!m_send_eos)
  781
+    m_omxAudio.WaitCompletion();
  782
+  m_send_eos = true;
779 783
 }
780 784
 
781 785
 void OMXPlayerAudio::RegisterAudioCallback(IAudioCallback *pCallback)
2  xbmc/cores/omxplayer/OMXPlayerAudio.h
@@ -88,6 +88,7 @@ class OMXPlayerAudio : public CThread
88 88
   bool                      m_DecoderOpen;
89 89
 
90 90
   DllBcmHost                m_DllBcmHost;
  91
+  bool                      m_send_eos;
91 92
 
92 93
   virtual void OnStartup();
93 94
   virtual void OnExit();
@@ -104,6 +105,7 @@ class OMXPlayerAudio : public CThread
104 105
   bool IsInited() const                             { return m_messageQueue.IsInited(); }
105 106
   int  GetLevel() const                             { return m_messageQueue.GetLevel(); }
106 107
   bool IsStalled()                                  { return m_stalled;  }
  108
+  bool IsEOS()                                      { return m_send_eos; };
107 109
   void WaitForBuffers();
108 110
   bool CloseStream(bool bWaitForBuffers);
109 111
   bool CodecChange();
8  xbmc/cores/omxplayer/OMXPlayerVideo.cpp
@@ -95,6 +95,7 @@ OMXPlayerVideo::OMXPlayerVideo(OMXClock *av_clock,
95 95
   m_dropbase              = 0.0;
96 96
   m_autosync              = 1;
97 97
   m_fForcedAspectRatio    = 0.0f;
  98
+  m_send_eos              = false;
98 99
   m_messageQueue.SetMaxDataSize(10 * 1024 * 1024);
99 100
   m_messageQueue.SetMaxTimeSize(8.0);
100 101
 
@@ -157,6 +158,7 @@ bool OMXPlayerVideo::OpenStream(CDVDStreamInfo &hints)
157 158
   */
158 159
 
159 160
   m_open        = true;
  161
+  m_send_eos    = false;
160 162
 
161 163
   return true;
162 164
 }
@@ -706,7 +708,7 @@ bool OMXPlayerVideo::OpenDecoder()
706 708
 
707 709
   if(!bVideoDecoderOpen)
708 710
   {
709  
-    CLog::Log(LOGERROR, "OMXPlayerAudio : Error open video output");
  711
+    CLog::Log(LOGERROR, "OMXPlayerVideo : Error open video output");
710 712
     m_omxVideo.Close();
711 713
   }
712 714
   else
@@ -746,7 +748,9 @@ int  OMXPlayerVideo::GetDecoderFreeSpace()
746 748
 
747 749
 void OMXPlayerVideo::WaitCompletion()
748 750
 {
749  
-  m_omxVideo.WaitCompletion();
  751
+  if(!m_send_eos)
  752
+    m_omxVideo.WaitCompletion();
  753
+  m_send_eos = true;
750 754
 }
751 755
 
752 756
 void OMXPlayerVideo::SetSpeed(int speed)
2  xbmc/cores/omxplayer/OMXPlayerVideo.h
@@ -81,6 +81,7 @@ class OMXPlayerVideo : public CThread
81 81
   int                       m_view_mode;
82 82
 
83 83
   DllBcmHost                m_DllBcmHost;
  84
+  bool                      m_send_eos;
84 85
 
85 86
   CDVDOverlayContainer  *m_pOverlayContainer;
86 87
   CDVDMessageQueue      &m_messageParent;
@@ -107,6 +108,7 @@ class OMXPlayerVideo : public CThread
107 108
   void WaitForBuffers()                             { m_messageQueue.WaitUntilEmpty(); }
108 109
   int  GetLevel() const                             { return m_messageQueue.GetLevel(); }
109 110
   bool IsStalled()                                  { return m_stalled;  }
  111
+  bool IsEOS()                                      { return m_send_eos; };
110 112
   bool CloseStream(bool bWaitForBuffers);
111 113
   void Output(int iGroupId, double pts, bool bDropPacket);
112 114
   void Flush();
5  xbmc/cores/omxplayer/OMXVideo.cpp
@@ -949,12 +949,15 @@ void COMXVideo::WaitCompletion()
949 949
     return;
950 950
   }
951 951
 
952  
-  unsigned int nTimeOut = 5000;
  952
+  unsigned int nTimeOut = 30000;
953 953
 
954 954
   while(nTimeOut)
955 955
   {
956 956
     if(m_omx_render.IsEOS())
  957
+    {
  958
+      CLog::Log(LOGDEBUG, "%s::%s - got eos\n", CLASSNAME, __func__);
957 959
       break;
  960
+    }
958 961
 
959 962
     if(nTimeOut == 0)
960 963
     {

0 notes on commit fae30c3

Please sign in to comment.
Something went wrong with that request. Please try again.