OSDN Git Service

RIO-7265: Memory leak fix in PV2WayWinVideoMIONode
authorPacketVideo CM <engbuild@pv.com>
Thu, 1 Oct 2009 17:41:11 +0000 (10:41 -0700)
committerPacketVideo CM <engbuild@pv.com>
Thu, 1 Oct 2009 17:41:11 +0000 (10:41 -0700)
16 files changed:
engines/2way/sample_app/pv2waysample/include/pv_2way_dummy_input_mio_node_factory.h
engines/2way/sample_app/pv2waysample/include/pv_2way_dummy_output_mio_node_factory.h
engines/2way/sample_app/pv2waysample/include/pv_2way_media_input_mio_node_factory.h
engines/2way/sample_app/pv2waysample/include/pv_2way_media_output_mio_node_factory.h
engines/2way/sample_app/pv2waysample/include/pv_2way_mio.h
engines/2way/sample_app/pv2waysample/include/pv_2way_mio_node_factory.h
engines/2way/sample_app/pv2waysample/include/pv_2way_source_and_sinks_base.h
engines/2way/sample_app/pv2waysample/include/pv_2way_source_and_sinks_dummy.h
engines/2way/sample_app/pv2waysample/include/pv_2way_source_and_sinks_file.h
engines/2way/sample_app/pv2waysample/src/pv_2way_mio.cpp
engines/2way/sample_app/pv2waysample/src/pv_2way_source_and_sinks_base.cpp
engines/2way/sample_app/pv2waysample/src/pv_2way_source_and_sinks_dummy.cpp
engines/2way/sample_app/pv2waysample/src/pv_2way_source_and_sinks_file.cpp
engines/2way/src/pv_2way_sdkinfo.h
engines/author/src/pv_author_sdkinfo.h
engines/player/src/pv_player_sdkinfo.h

index 075d804..96ab19a 100644 (file)
 
 class PvmiMIOControl;
 
-class PV2WayDummyInputMIONodeFactory: public PV2WayMIONodeFactory
+class PV2WayDummyInputMIONodeFactory: public HeapBase, public PV2WayMIONodeFactory
 {
     public:
+        void Release()
+        {
+            delete this;
+        }
         PV2WayDummyInputMIONodeFactory() {};
         virtual ~PV2WayDummyInputMIONodeFactory() {};
         OSCL_IMPORT_REF virtual PVMFNodeInterface* Create(LipSyncDummyMIOSettings& aSettings);
index 5de082a..86afbb0 100644 (file)
 #include "lipsync_dummy_settings.h"
 class PvmiMIOControl;
 
-class PV2WayDummyOutputMIONodeFactory : public PV2WayMIONodeFactory
+class PV2WayDummyOutputMIONodeFactory : public HeapBase, public PV2WayMIONodeFactory
 {
     public:
+        void Release()
+        {
+            delete this;
+        }
         PV2WayDummyOutputMIONodeFactory() {};
         virtual ~PV2WayDummyOutputMIONodeFactory() {};
         OSCL_IMPORT_REF virtual PVMFNodeInterface* Create(LipSyncDummyMIOSettings& aSettings);
index e21394c..e8baa5a 100644 (file)
 #include "pv_2way_mio_node_factory.h"
 #include "pvmi_mio_fileinput_factory.h"
 
-class PV2WayMediaInputMIONodeFactory: public PV2WayMIONodeFactory
+class PV2WayMediaInputMIONodeFactory: public HeapBase, public PV2WayMIONodeFactory
 {
     public:
-        PV2WayMediaInputMIONodeFactory() {};
-        virtual ~PV2WayMediaInputMIONodeFactory() {};
+        OSCL_IMPORT_REF void Release()
+        {
+            delete this;
+        }
+        OSCL_IMPORT_REF PV2WayMediaInputMIONodeFactory() {};
+        OSCL_IMPORT_REF virtual ~PV2WayMediaInputMIONodeFactory() {};
         OSCL_IMPORT_REF virtual PVMFNodeInterface* Create(PvmiMIOFileInputSettings& aFileSettings);
         OSCL_IMPORT_REF virtual void Delete(PVMFNodeInterface** mioNode);
     private:
index af0cf2a..69c26d7 100644 (file)
 #include "pvmi_mio_fileinput_factory.h"
 
 
-class PV2WayMediaOutputMIONodeFactory : public PV2WayMIONodeFactory
+class PV2WayMediaOutputMIONodeFactory : public HeapBase, public PV2WayMIONodeFactory
 {
     public:
-        PV2WayMediaOutputMIONodeFactory() {};
-        virtual ~PV2WayMediaOutputMIONodeFactory() {};
+        OSCL_IMPORT_REF void Release()
+        {
+            delete this;
+        }
+        OSCL_IMPORT_REF PV2WayMediaOutputMIONodeFactory() {};
+        OSCL_IMPORT_REF virtual ~PV2WayMediaOutputMIONodeFactory() {};
         OSCL_IMPORT_REF virtual PVMFNodeInterface* Create(PvmiMIOFileInputSettings& aFileSettings);
         OSCL_IMPORT_REF virtual void Delete(PVMFNodeInterface** mioNode);
     private:
index e17bbfe..51671dc 100644 (file)
@@ -194,7 +194,7 @@ class PV2WayMIO
                            PVMFFormatType& aMimeString,
                            int& aMedia_type);
 
-        void OutputInfo(const char * str, ...)
+        void OutputInfo(PVLogger::log_level_type aLogLevel, const char * str, ...)
         {
             va_list args;
             va_start(args, str);
@@ -208,7 +208,7 @@ class PV2WayMIO
             {
                 iLogger = PVLogger::GetLoggerObject("PV2WaySourceAndSinks.PV2WayMIO");
             }
-            PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_DEBUG,
+            PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, aLogLevel,
                             (0, "---PV2WayMIO:: %s", buffer));
             va_end(args);
         }
index 67b603f..26393dd 100644 (file)
 class PV2WayMIONodeFactory
 {
     public:
-        PV2WayMIONodeFactory() {};
-        virtual ~PV2WayMIONodeFactory() {};
-        //virtual PVMFNodeInterface* Create() = 0;
+        virtual void Release() = 0;
         virtual void Delete(PVMFNodeInterface** mioNode) = 0;
+
+    protected:
+        virtual ~PV2WayMIONodeFactory() {};
 };
 
 
index 485640e..2f18d60 100644 (file)
@@ -165,7 +165,7 @@ class PV2WaySourceAndSinksBase :   public PVCommandStatusObserver,
         OSCL_IMPORT_REF PV2WayMIO* GetMIO(TPVDirection aDir,
                                           PV2WayMediaType aMediaType);
 
-        virtual void OutputInfo(const char * str, ...) = 0;
+        virtual void OutputInfo(PVLogger::log_level_type aLogLevel, const char * str, ...) = 0;
 
 
 
index b7cd585..cbaa742 100644 (file)
@@ -59,8 +59,9 @@ class PV2WayDummySourceAndSinks : public PV2WaySourceAndSinksBase
                                            TPVDirection adir,
                                            PVMFNodeInterface** aMioNode);
     protected:
-        void OutputInfo(const char * str, ...)
+        void OutputInfo(PVLogger::log_level_type aLogLevel, const char * str, ...)
         {
+            OSCL_UNUSED_ARG(aLogLevel);
             // output to screen everything in formatted string
             va_list ap;
             va_start(ap, str);
index 853598d..e1aba2d 100644 (file)
@@ -59,8 +59,9 @@ class PV2WaySourceAndSinksFile : public PV2WaySourceAndSinksBase
                                            TPVDirection adir,
                                            PVMFNodeInterface** aMioNode);
     protected:
-        void OutputInfo(const char * str, ...)
+        void OutputInfo(PVLogger::log_level_type aLogLevel, const char * str, ...)
         {
+            OSCL_UNUSED_ARG(aLogLevel);
             // output to screen everything in formatted string
             va_list ap;
             va_start(ap, str);
index ef2b047..ad70263 100644 (file)
@@ -99,7 +99,7 @@ OSCL_EXPORT_REF void PV2WayMIO::AddCompleted(const PVCmdResponse& aResponse)
     }
     else
     {
-        OutputInfo("PV2WayMIO::AddCompleted:: Failed to add MIO");
+        OutputInfo(PVLOGMSG_ERR, "PV2WayMIO::AddCompleted:: Failed to add MIO");
         Closed();
     }
 
@@ -125,7 +125,7 @@ OSCL_EXPORT_REF PVCommandId PV2WayMIO::Add()
                                      *iMioNode));
             if (error)
             {
-                OutputInfo("PV2WayMIO::Add():: Error Adding Data Sink!");
+                OutputInfo(PVLOGMSG_ERR, "PV2WayMIO::Add():: Error Adding Data Sink!");
             }
             return iAddId;
         }
@@ -135,18 +135,18 @@ OSCL_EXPORT_REF PVCommandId PV2WayMIO::Add()
                                      *iMioNode));
             if (error)
             {
-                OutputInfo("PV2WayMIO::Add():: Error Adding Data Source!");
+                OutputInfo(PVLOGMSG_ERR, "PV2WayMIO::Add():: Error Adding Data Source!");
             }
             return iAddId;
         }
     }
     else if (!iRemoving)
     {
-        OutputInfo("\nError: MIO already added!\n");
+        OutputInfo(PVLOGMSG_ERR, "\nError: MIO already added!\n");
     }
     else if (iRemoving)
     {
-        OutputInfo("\nCannot add because attempting to remove MIO!\n");
+        OutputInfo(PVLOGMSG_ERR, "\nCannot add because attempting to remove MIO!\n");
     }
     return -1;
 }
@@ -167,7 +167,7 @@ OSCL_EXPORT_REF PVCommandId PV2WayMIO::Remove()
             OSCL_TRY(error, iRemoveId = iTerminal->RemoveDataSink(*iMioNode));
             if (error)
             {
-                OutputInfo("\n Error in RemoveDataSink!\n");
+                OutputInfo(PVLOGMSG_ERR, "\n Error in RemoveDataSink!\n");
             }
             return iRemoveId;
         }
@@ -176,14 +176,14 @@ OSCL_EXPORT_REF PVCommandId PV2WayMIO::Remove()
             OSCL_TRY(error, iRemoveId = iTerminal->RemoveDataSource(*iMioNode));
             if (error)
             {
-                OutputInfo("\n Error in RemoveDataSource!\n");
+                OutputInfo(PVLOGMSG_ERR, "\n Error in RemoveDataSource!\n");
             }
             return iRemoveId;
         }
     }
     else if (!iAdded)
     {
-        OutputInfo("\nError: MIO cannot be removed because has not been added!\n");
+        OutputInfo(PVLOGMSG_ERR, "\nError: MIO cannot be removed because has not been added!\n");
     }
     return -1;
 }
@@ -230,33 +230,33 @@ OSCL_EXPORT_REF PVCommandId PV2WayMIO::HandleEvent(const PVAsyncInformationalEve
     {
         if (((PVAsyncInformationalEvent&)aEvent).GetLocalBuffer()[0] == PV_VIDEO)
         {
-            OutputInfo("PVT_INDICATION_INCOMING_TRACK video, id %d\n", id);
+            OutputInfo(PVLOGMSG_INFO, "PVT_INDICATION_INCOMING_TRACK video, id %d\n", id);
         }
         else if (((PVAsyncInformationalEvent&)aEvent).GetLocalBuffer()[0] == PV_AUDIO)
         {
-            OutputInfo("PVT_INDICATION_INCOMING_TRACK audio, id %d\n", id);
+            OutputInfo(PVLOGMSG_INFO, "PVT_INDICATION_INCOMING_TRACK audio, id %d\n", id);
         }
     }
     else if (PVT_INDICATION_OUTGOING_TRACK == aEvent.GetEventType())
     {
         if (((PVAsyncInformationalEvent&)aEvent).GetLocalBuffer()[0] == PV_VIDEO)
         {
-            OutputInfo("PVT_INDICATION_OUTGOING_TRACK video, id %d\n", id);
+            OutputInfo(PVLOGMSG_INFO, "PVT_INDICATION_OUTGOING_TRACK video, id %d\n", id);
         }
         else if (((PVAsyncInformationalEvent&)aEvent).GetLocalBuffer()[0] == PV_AUDIO)
         {
-            OutputInfo("PVT_INDICATION_OUTGOING_TRACK audio, id %d\n", id);
+            OutputInfo(PVLOGMSG_INFO, "PVT_INDICATION_OUTGOING_TRACK audio, id %d\n", id);
         }
     }
     if (iChannelId == id)
     {
-        OutputInfo("\nDuplicate callback for  id %d\n", id);
+        OutputInfo(PVLOGMSG_WARNING, "\nDuplicate callback for  id %d\n", id);
         return -1;
     }
 
     if (iChannelId)
     {
-        OutputInfo("\nBusy ... MIO id=%d being closed\n", iChannelId);
+        OutputInfo(PVLOGMSG_WARNING, "\nBusy ... MIO id=%d being closed\n", iChannelId);
         iNextChannelId = id;
         return -1;
     }
@@ -274,7 +274,7 @@ OSCL_EXPORT_REF PVCommandId PV2WayMIO::HandleEvent(const PVAsyncInformationalEve
         }
         else
         {
-            OutputInfo("\nDid not find a codec!!! \n");
+            OutputInfo(PVLOGMSG_WARNING, "\nDid not find a codec!!! \n");
         }
     }
     return retvalue;
@@ -332,7 +332,7 @@ OSCL_EXPORT_REF void PV2WayMIO::PrintFormatTypes()
         iFormatsMap.begin();
     if (it == iFormatsMap.end())
     {
-        OutputInfo("No formats added.");
+        OutputInfo(PVLOGMSG_NOTICE, "No formats added.");
         return;
     }
     // loop through each, output values
@@ -340,8 +340,8 @@ OSCL_EXPORT_REF void PV2WayMIO::PrintFormatTypes()
     {
         CodecSpecifier* codec = (*it++).second;
         PVMFFormatType format = codec->GetFormat();
-        OutputInfo("%s", format.getMIMEStrPtr());
-        OutputInfo(" ");
+        OutputInfo(PVLOGMSG_INFO, "%s", format.getMIMEStrPtr());
+        OutputInfo(PVLOGMSG_INFO, " ");
     }
 }
 
@@ -366,11 +366,11 @@ CodecSpecifier* PV2WayMIO::FormatMatchesCapabilities(const PVAsyncInformationalE
     CodecSpecifier* formatInList = FormatInList(aMimeString);
     if (!formatInList)
     {
-        OutputInfo("Format %s does not match application capability\n", aMimeString.getMIMEStrPtr());
+        OutputInfo(PVLOGMSG_INFO, "Format %s does not match application capability\n", aMimeString.getMIMEStrPtr());
     }
     else
     {
-        OutputInfo("Format %s matches application capabilities\n", aMimeString.getMIMEStrPtr());
+        OutputInfo(PVLOGMSG_INFO, "Format %s matches application capabilities\n", aMimeString.getMIMEStrPtr());
     }
 
     return formatInList;
index 6a6ddeb..004a3db 100644 (file)
@@ -126,7 +126,7 @@ OSCL_EXPORT_REF int PV2WaySourceAndSinksBase::ResetPreferredCodec(TPVDirection a
         mio->ClearCodecs();
         return 0;
     }
-    OutputInfo("PV2WaySourceAndSinksBase::ResetPreferredCodec: Error!  No MIO of given dir, type");
+    OutputInfo(PVLOGMSG_ERR, "PV2WaySourceAndSinksBase::ResetPreferredCodec: Error!  No MIO of given dir, type");
     return -1;
 }
 
@@ -227,7 +227,7 @@ OSCL_EXPORT_REF void PV2WaySourceAndSinksBase::HandleClosingTrack(const PVAsyncI
 {
     TPVDirection dir = (TPVDirection)((PVAsyncInformationalEvent&)aEvent).GetLocalBuffer()[0];
     TPVChannelId id = GetIdFromLocalBuffer((PVAsyncInformationalEvent &) aEvent);
-    OutputInfo("PVT_INDICATION_CLOSING_TRACK dir=%d, id %u\n", dir, id);
+    OutputInfo(PVLOGMSG_INFO, "PVT_INDICATION_CLOSING_TRACK dir=%d, id %u\n", dir, id);
     if (dir == INCOMING)
     {
         if (iAudioSink->IsChannelId(id))
@@ -258,17 +258,17 @@ OSCL_EXPORT_REF void PV2WaySourceAndSinksBase::HandleCloseTrack(const PVAsyncInf
 
     TPVDirection dir = (TPVDirection)((PVAsyncInformationalEvent&)aEvent).GetLocalBuffer()[0];
     TPVChannelId id = GetIdFromLocalBuffer((PVAsyncInformationalEvent &) aEvent);
-    OutputInfo("PVT_INDICATION_CLOSE_TRACK dir=%d, id=%u", dir, id);
+    OutputInfo(PVLOGMSG_STACK_TRACE, "PV2WaySourceAndSinksBase::HandleCloseTrack() - PVT_INDICATION_CLOSE_TRACK dir=%d, id=%u", dir, id);
     if (dir == INCOMING)
     {
         if (iVideoSink->IsChannelId(id))
         {
-            OutputInfo("\nIncoming video track closed\n");
+            OutputInfo(PVLOGMSG_INFO, "\nIncoming video track closed\n");
             iVideoSink->HandleCloseTrack();
         }
         else if (iAudioSink->IsChannelId(id))
         {
-            OutputInfo("\nIncoming audio track closed\n");
+            OutputInfo(PVLOGMSG_INFO, "\nIncoming audio track closed\n");
             iAudioSink->HandleCloseTrack();
         }
     }
@@ -276,12 +276,12 @@ OSCL_EXPORT_REF void PV2WaySourceAndSinksBase::HandleCloseTrack(const PVAsyncInf
     {
         if (iVideoSource->IsChannelId(id))
         {
-            OutputInfo("\nOutgoing video track closed\n");
+            OutputInfo(PVLOGMSG_INFO, "\nOutgoing video track closed\n");
             iVideoSource->HandleCloseTrack();
         }
         else if (iAudioSource->IsChannelId(id))
         {
-            OutputInfo("\nOutgoing audio track closed\n");
+            OutputInfo(PVLOGMSG_INFO, "\nOutgoing audio track closed\n");
             iAudioSource->HandleCloseTrack();
         }
     }
@@ -289,13 +289,13 @@ OSCL_EXPORT_REF void PV2WaySourceAndSinksBase::HandleCloseTrack(const PVAsyncInf
 
 OSCL_EXPORT_REF void PV2WaySourceAndSinksBase::PrintFormatTypes()
 {
-    OutputInfo("\nAudio Sink Format Types: ");
+    OutputInfo(PVLOGMSG_INFO, "\nAudio Sink Format Types: ");
     iAudioSink->PrintFormatTypes();
-    OutputInfo("\nAudio Source Format Types: ");
+    OutputInfo(PVLOGMSG_INFO, "\nAudio Source Format Types: ");
     iAudioSource->PrintFormatTypes();
-    OutputInfo("\nVideo Sink Format Types: ");
+    OutputInfo(PVLOGMSG_INFO, "\nVideo Sink Format Types: ");
     iVideoSink->PrintFormatTypes();
-    OutputInfo("\nVideo Source Format Types: ");
+    OutputInfo(PVLOGMSG_INFO, "\nVideo Source Format Types: ");
     iVideoSource->PrintFormatTypes();
 }
 
@@ -303,7 +303,7 @@ OSCL_EXPORT_REF bool PV2WaySourceAndSinksBase::FormatMatchesSelectedCodec(TPVDir
         PV2WayMediaType aMediaType, PVMFFormatType& aFormat)
 {
     PVMFFormatType& form = GetMIO(aDir, aMediaType)->GetSelectedFormat();
-    OutputInfo(" Expected: %s and Found: %s match? %d --------\n",
+    OutputInfo(PVLOGMSG_INFO, " Expected: %s and Found: %s match? %d --------\n",
                aFormat.getMIMEStrPtr(), form.getMIMEStrPtr(), (form == aFormat));
     return (form == aFormat) ? true : false;
 }
index 44bc2b8..cabb939 100644 (file)
@@ -42,7 +42,7 @@ OSCL_EXPORT_REF int PV2WayDummySourceAndSinks::AddPreferredCodec(TPVDirection aD
         mio->AddCodec(aSettings);
         return 0;
     }
-    OutputInfo("PV2WaySourceAndSinksBase::AddPreferredCodec: Error!  No MIO of given dir, type");
+    OutputInfo(PVLOGMSG_ERR, "PV2WaySourceAndSinksBase::AddPreferredCodec: Error!  No MIO of given dir, type");
     return -1;
 }
 
index cd231b4..0dcafcf 100644 (file)
@@ -42,7 +42,7 @@ OSCL_EXPORT_REF int PV2WaySourceAndSinksFile::AddPreferredCodec(TPVDirection aDi
         mio->AddCodec(aFileSettings);
         return 0;
     }
-    OutputInfo("PV2WaySourceAndSinksBase::AddPreferredCodec: Error!  No MIO of given dir, type");
+    OutputInfo(PVLOGMSG_ERR, "PV2WaySourceAndSinksBase::AddPreferredCodec: Error!  No MIO of given dir, type");
     return -1;
 }
 
index d2db76a..2a7747f 100644 (file)
@@ -21,7 +21,7 @@
 // This header file is automatically generated at build-time
 // *** OFFICIAL RELEASE INFO -- Will not auto update
 
-#define PV2WAY_ENGINE_SDKINFO_LABEL "983785"
+#define PV2WAY_ENGINE_SDKINFO_LABEL "983931"
 #define PV2WAY_ENGINE_SDKINFO_DATE 0x20090925
 
 #endif //PV_2WAY_SDKINFO_H_INCLUDED
index aac5107..34ef346 100644 (file)
@@ -21,7 +21,7 @@
 // This header file is automatically generated at build-time
 // *** OFFICIAL RELEASE INFO -- Will not auto update
 
-#define PVAUTHOR_ENGINE_SDKINFO_LABEL "983785"
+#define PVAUTHOR_ENGINE_SDKINFO_LABEL "983931"
 #define PVAUTHOR_ENGINE_SDKINFO_DATE 0x20090925
 
 #endif //PV_AUTHOR_SDKINFO_H_INCLUDED
index f6531c8..e7a928b 100644 (file)
@@ -21,7 +21,7 @@
 // This header file is automatically generated at build-time
 // *** OFFICIAL RELEASE INFO -- Will not auto update
 
-#define PVPLAYER_ENGINE_SDKINFO_LABEL "983785"
+#define PVPLAYER_ENGINE_SDKINFO_LABEL "983931"
 #define PVPLAYER_ENGINE_SDKINFO_DATE 0x20090925
 
 #endif //PV_PLAYER_SDKINFO_H_INCLUDED