dvdplayer: Make sure packet status is self contained with constructor and destructor
authorJoakim Plate <elupus@ecce.se>
Sun, 2 Sep 2012 08:21:02 +0000 (10:21 +0200)
committerJoakim Plate <elupus@ecce.se>
Sun, 2 Sep 2012 08:27:14 +0000 (10:27 +0200)
xbmc/cores/dvdplayer/DVDPlayerAudio.cpp
xbmc/cores/dvdplayer/DVDPlayerAudio.h

index 90f0784..3cd44c0 100644 (file)
@@ -184,7 +184,6 @@ CDVDPlayerAudio::CDVDPlayerAudio(CDVDClock* pClock, CDVDMessageQueue& parent)
 
   m_freq = CurrentHostFrequency();
 
-  m_decode.msg = NULL;
   m_messageQueue.SetMaxDataSize(6 * 1024 * 1024);
   m_messageQueue.SetMaxTimeSize(8.0);
   g_dvdPerformanceCounter.EnableAudioQueue(&m_messageQueue);
@@ -545,7 +544,6 @@ int CDVDPlayerAudio::DecodeFrame(DVDAudioFrame &audioframe, bool bDropPacket)
 
 void CDVDPlayerAudio::OnStartup()
 {
-  m_decode.msg = NULL;
   m_decode.Release();
 
   g_dvdPerformanceCounter.EnableAudioDecodePerformance(this);
index 988d171..cc6e4cb 100644 (file)
@@ -150,8 +150,19 @@ protected:
   double m_audioClock;
 
   // data for audio decoding
-  struct
+  struct PacktetStatus
   {
+    PacktetStatus()
+    {
+        msg = NULL;
+        Release();
+    }
+
+   ~PacktetStatus()
+    {
+        Release();
+    }
+
     CDVDMsgDemuxerPacket*  msg;
     BYTE*                  data;
     int                    size;
@@ -159,6 +170,7 @@ protected:
 
     void Attach(CDVDMsgDemuxerPacket* msg2)
     {
+      if(msg) msg->Release();
       msg = msg2;
       msg->Acquire();
       DemuxPacket* p = msg->GetPacket();