[Confluence] align subtitle popup to the bottom
[vuplus_xbmc] / xbmc / cores / dvdplayer / DVDCodecs / Video / StageFrightVideo.cpp
index 0c70c81..4060f3b 100644 (file)
@@ -298,10 +298,11 @@ public:
       else
       {
         CLog::Log(LOGERROR, "%s - decoding error (%d)\n", CLASSNAME,frame->status);
-        decode_done   = 1;
         if (frame->medbuf)
           frame->medbuf->release();
         frame->medbuf = NULL;
+        free(frame);
+        continue;
       }
 
       if (frame->format == RENDER_FMT_EGLIMG)
@@ -501,12 +502,8 @@ bool CStageFrightVideo::Open(CDVDStreamInfo &hints)
     goto fail;
   }
 
-  p->mVideoNativeWindow = NULL;
   if ((p->quirks & QuirkSWRender) == 0)
-  {
     p->InitStagefrightSurface();
-    native_window_api_connect(p->mVideoNativeWindow.get(), NATIVE_WINDOW_API_MEDIA);
-  }
 
   p->decoder  = OMXCodec::Create(p->client->interface(), p->meta,
                                          false, p->source, NULL,
@@ -532,25 +529,17 @@ bool CStageFrightVideo::Open(CDVDStreamInfo &hints)
     CLog::Log(LOGDEBUG, "%s::%s - component: %s\n", CLASSNAME, __func__, component);
 
     //Blacklist
-    if (!strncmp(component, "OMX.Nvidia.mp4.decode", 21) && g_advancedSettings.m_stagefrightConfig.useMP4codec != 1)
+    if (!strncmp(component, "OMX.google", 10))
     {
-      // Has issues with some XVID encoded MP4. Only fails after actual decoding starts...
-      CLog::Log(LOGERROR, "%s::%s - %s\n", CLASSNAME, __func__,"Blacklisted component (MP4)");
+      // On some platforms, software decoders are returned anyway
+      CLog::Log(LOGERROR, "%s::%s - %s\n", CLASSNAME, __func__,"Blacklisted component (software)");
       goto fail;
-
     }
-    else if (!strncmp(component, "OMX.rk.", 7))
+    else if (!strncmp(component, "OMX.Nvidia.mp4.decode", 21) && g_advancedSettings.m_stagefrightConfig.useMP4codec != 1)
     {
-      if (g_advancedSettings.m_stagefrightConfig.useAVCcodec != 1 && g_advancedSettings.m_stagefrightConfig.useMP4codec != 1) 
-      {
-        if (p->width % 32 != 0 || p->height % 16 != 0)
-        {
-          // Buggy. Hard crash on non MOD16 height videos and stride errors for non MOD32 width
-          CLog::Log(LOGERROR, "%s::%s - %s\n", CLASSNAME, __func__,"Blacklisted component (MOD16)");
-          goto fail;
-
-        }
-      }
+      // Has issues with some XVID encoded MP4. Only fails after actual decoding starts...
+      CLog::Log(LOGERROR, "%s::%s - %s\n", CLASSNAME, __func__,"Blacklisted component (MP4)");
+      goto fail;
     }
   }
 
@@ -614,6 +603,7 @@ int  CStageFrightVideo::Decode(uint8_t *pData, int iSize, double dts, double pts
   Frame *frame;
   int demuxer_bytes = iSize;
   uint8_t *demuxer_content = pData;
+  int ret = 0;
 
   if (demuxer_content)
   {
@@ -626,12 +616,21 @@ int  CStageFrightVideo::Decode(uint8_t *pData, int iSize, double dts, double pts
       frame->pts = (dts != DVD_NOPTS_VALUE) ? pts_dtoi(dts) : ((pts != DVD_NOPTS_VALUE) ? pts_dtoi(pts) : 0);
     else
       frame->pts = (pts != DVD_NOPTS_VALUE) ? pts_dtoi(pts) : ((dts != DVD_NOPTS_VALUE) ? pts_dtoi(dts) : 0);
+
+    // No valid pts? libstagefright asserts on this.
+    if (frame->pts < 0)
+    {
+      free(frame);
+      return ret;
+    }
+
     frame->medbuf = p->getBuffer(demuxer_bytes);
     if (!frame->medbuf)
     {
       free(frame);
       return VC_ERROR;
     }
+
     fast_memcpy(frame->medbuf->data(), demuxer_content, demuxer_bytes);
     frame->medbuf->meta_data()->clear();
     frame->medbuf->meta_data()->setInt64(kKeyTime, frame->pts);
@@ -643,7 +642,6 @@ int  CStageFrightVideo::Decode(uint8_t *pData, int iSize, double dts, double pts
     p->in_mutex.unlock();
   }
 
-  int ret = 0;
   if (p->inputBufferAvailable() && p->in_queue.size() < INBUFCOUNT)
     ret |= VC_BUFFER;
   else