]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Minor change in stream handling
authorMarten Richter <marten.richter@freenet.de>
Sat, 16 Mar 2013 10:56:09 +0000 (11:56 +0100)
committerMarten Richter <marten.richter@freenet.de>
Sat, 16 Mar 2013 10:56:09 +0000 (11:56 +0100)
audioomx.cc
audioomx.h
draintarget.h
stream.cc
videoomx.cc
videoomx.h

index cf4f564b1721ff7157ae4b9749264038d8abef5b..68d3c5634084eec831e047520ae95bdbc54893aa 100644 (file)
@@ -1602,6 +1602,7 @@ unsigned int AudioOMX::AdvanceMpAudioSync(const UCHAR *data,unsigned int size,un
                                frame_size=(frame_size*144000)/(sample_rate<<lsf);
                                frame_size=frame_size+padding;
                        }
+                       //Log::getInstance()->log("Audio", Log::DEBUG, "FRAME: %d %d %d %d %d %d",lsf,layer,bitrate_index,sample_rate,padding,framesize);
                        *framesize=frame_size;
 
                        return test; // probably FrameSync
@@ -1748,6 +1749,16 @@ long long AudioOMX::correctAudioLatency(long long pts,int addsamples,int srate)
        return workpts;
 }
 
+bool AudioOMX::DrainTargetBufferFull()
+{
+       //Check, if we have OMX output buffers
+       bool full;
+       input_bufs_omx_mutex.Lock();
+       full=(input_bufs_omx_free.size()==0);
+       input_bufs_omx_mutex.Unlock();
+       return full;
+
+}
 
 
 UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer,
index 74ac21ddd36584102560db33196673cd15e67f2e..42f525bc1fbaedb40fc7d67ecd00d6a31c5ed840 100644 (file)
@@ -90,6 +90,7 @@ class AudioOMX : public Audio
     virtual void ResetTimeOffsets();
 
     virtual bool DrainTargetReady() {return omx_running;};
+    virtual bool DrainTargetBufferFull();
 
 
        UCHAR getLastAType() {return lastAType;}
index 95d5e0669ccd4f34585c214042b6467a6fc8f86e..e3a8f2b195050f4076c814686a2ee91705653998 100644 (file)
@@ -70,6 +70,7 @@ class DrainTarget
     virtual void ResetTimeOffsets()=0;
 
     virtual bool DrainTargetReady() {return false;}; //if the draintarget is blocking in paused state, this tells that it is ready to rumble
+    virtual bool DrainTargetBufferFull() { return false;};
 
     virtual bool dtsTimefix(){return false;} //determines if the draintargets needs a mixure of pts and dts or not
 
index 665739b9f6e9b36faf0a03ac4b410f9d7308d30b..5fb8c702b5e80a6f1e152cee9a8005cf67711f77 100644 (file)
--- a/stream.cc
+++ b/stream.cc
@@ -164,6 +164,7 @@ bool Stream::drain(bool * dataavail)
 {
   bool ret = false;
   if (dataavail) *dataavail=false;
+  if (draintarget->DrainTargetBufferFull()) return false; //We are full, no need to do something else
   lock();
   UINT listlength = mediapackets.size();
   if (listlength != 0)
index fdf7b5d8d2e39311b3368a5be553e0ac6afa20b2..085441e80428c5731509c4a9535f7a3a9b24b211 100644 (file)
@@ -1702,8 +1702,6 @@ int VideoOMX::CommandFinished(OMX_HANDLETYPE handle,OMX_U32 command,OMX_U32 data
 
 
 
-
-
 int VideoOMX::PrepareInputBufsOMX() //needs to be called with locked mutex
 {
        OMX_ERRORTYPE error;
@@ -2562,6 +2560,19 @@ bool VideoOMX::detectIFrame(const UCHAR *buffer,unsigned int length)
        return false; // no frame found
 }
 
+
+
+bool VideoOMX::DrainTargetBufferFull()
+{
+       //Check, if we have OMX output buffers
+       bool full;
+       input_bufs_omx_mutex.Lock();
+       full=(input_bufs_omx_free.size()==0);
+       input_bufs_omx_mutex.Unlock();
+       return full;
+
+}
+
 void VideoOMX::PrepareMediaSample(const MediaPacketList& mplist,UINT samplepos)
 {
         
index 7974e4a492c8a11085e03e1a0b3e1725b8a6b062..602bc47121f8b672fe161df1f255639790017a99 100644 (file)
@@ -150,6 +150,8 @@ class VideoOMX : public Video
           bool iframemode;
           bool InIframemode() {return iframemode;};
 
+          virtual bool DrainTargetBufferFull();
+
           UINT DeliverMediaPacket(MediaPacket packet,const UCHAR* bulibaver,UINT *samplepos);
 
 #define VPE_DECODER_OMX 1