Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-opencore: Commit

external/opencore


Commit MetaInfo

Revisión695196cdcf5285c6008c5f9b93200b6a3e8af75c (tree)
Tiempo2010-04-16 05:34:33
AutorPacketVideo CM <engbuild@pv.c...>
CommiterPacketVideo CM

Log Message

RIO-7791: Fix for deadlock between player engine and OMX component threads caused by a mismatched queue depth and number of new output AVC buffers during port reconfiguration

Change-Id: I8f98f2486f39c6902ab2ff3fa642d033fb2e9a07

Cambiar Resumen

Diferencia incremental

--- a/engines/2way/src/pv_2way_sdkinfo.h
+++ b/engines/2way/src/pv_2way_sdkinfo.h
@@ -21,7 +21,7 @@
2121 // This header file is automatically generated at build-time
2222 // *** OFFICIAL RELEASE INFO -- Will not auto update
2323
24-#define PV2WAY_ENGINE_SDKINFO_LABEL "1364347"
25-#define PV2WAY_ENGINE_SDKINFO_DATE 0x20100407
24+#define PV2WAY_ENGINE_SDKINFO_LABEL "1366021"
25+#define PV2WAY_ENGINE_SDKINFO_DATE 0x20100408
2626
2727 #endif //PV_2WAY_SDKINFO_H_INCLUDED
--- a/engines/author/src/pv_author_sdkinfo.h
+++ b/engines/author/src/pv_author_sdkinfo.h
@@ -21,7 +21,7 @@
2121 // This header file is automatically generated at build-time
2222 // *** OFFICIAL RELEASE INFO -- Will not auto update
2323
24-#define PVAUTHOR_ENGINE_SDKINFO_LABEL "1364347"
25-#define PVAUTHOR_ENGINE_SDKINFO_DATE 0x20100407
24+#define PVAUTHOR_ENGINE_SDKINFO_LABEL "1366021"
25+#define PVAUTHOR_ENGINE_SDKINFO_DATE 0x20100408
2626
2727 #endif //PV_AUTHOR_SDKINFO_H_INCLUDED
--- a/engines/player/src/pv_player_sdkinfo.h
+++ b/engines/player/src/pv_player_sdkinfo.h
@@ -21,7 +21,7 @@
2121 // This header file is automatically generated at build-time
2222 // *** OFFICIAL RELEASE INFO -- Will not auto update
2323
24-#define PVPLAYER_ENGINE_SDKINFO_LABEL "1364347"
25-#define PVPLAYER_ENGINE_SDKINFO_DATE 0x20100407
24+#define PVPLAYER_ENGINE_SDKINFO_LABEL "1366021"
25+#define PVPLAYER_ENGINE_SDKINFO_DATE 0x20100408
2626
2727 #endif //PV_PLAYER_SDKINFO_H_INCLUDED
--- a/nodes/pvomxaudiodecnode/src/pvmf_omx_audiodec_node.cpp
+++ b/nodes/pvomxaudiodecnode/src/pvmf_omx_audiodec_node.cpp
@@ -610,18 +610,6 @@ PVMFStatus PVMFOMXAudioDecNode::HandlePortReEnable()
610610 return PVMFErrResource;
611611 }
612612
613- // send command for port re-enabling (for this to happen, we must first recreate the buffers)
614- Err = OMX_SendCommand(iOMXDecoder, OMX_CommandPortEnable, iPortIndexForDynamicReconfig, NULL);
615- if (Err != OMX_ErrorNone)
616- {
617- PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
618- (0, "PVMFOMXAudioDecNode::HandlePortReEnable() Port Reconfiguration -> problem sending Port Enable command at port %d", iPortIndexForDynamicReconfig));
619-
620- SetState(EPVMFNodeError);
621- ReportErrorEvent(PVMFErrResource);
622- return PVMFErrResource;
623- }
624-
625613
626614 // get also input info (for frame duration if necessary)
627615 OMX_PTR CodecProfilePtr;
@@ -738,6 +726,8 @@ PVMFStatus PVMFOMXAudioDecNode::HandlePortReEnable()
738726 if (iPortIndexForDynamicReconfig == iOutputPortIndex)
739727 {
740728
729+ uint32 iBeforeConfigNumOutputBuffers = iNumOutputBuffers;
730+
741731 // GET the output buffer params and sizes
742732 OMX_AUDIO_PARAM_PCMMODETYPE Audio_Pcm_Param;
743733 Audio_Pcm_Param.nPortIndex = iOutputPortIndex; // we're looking for output port params
@@ -986,6 +976,40 @@ PVMFStatus PVMFOMXAudioDecNode::HandlePortReEnable()
986976 ReportInfoEvent(PVMFPvmiBufferAllocatorNotAcquired);
987977 }
988978
979+
980+ if (iNumOutputBuffers > iBeforeConfigNumOutputBuffers)
981+ {
982+ //Reallocate FillBufferDone THREADSAFE CALLBACK AOs in case of port reconfiguration
983+ if (iThreadSafeHandlerFillBufferDone)
984+ {
985+ OSCL_DELETE(iThreadSafeHandlerFillBufferDone);
986+ iThreadSafeHandlerFillBufferDone = NULL;
987+ }
988+ // use the new queue depth of iNumOutputBuffers to prevent deadlock
989+ iThreadSafeHandlerFillBufferDone = OSCL_NEW(FillBufferDoneThreadSafeCallbackAO, (this, iNumOutputBuffers, "FillBufferDoneAO", Priority() + 1));
990+
991+ if (NULL == iThreadSafeHandlerFillBufferDone)
992+ {
993+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
994+ (0, "PVMFOMXAudioDecNode::HandlePortReEnable() Port Reconfiguration -> Can't reallocate FillBufferDone threadsafe callback queue!"));
995+ SetState(EPVMFNodeError);
996+ ReportErrorEvent(PVMFErrNoMemory);
997+ return false;
998+ }
999+ }
1000+
1001+ // send command for port re-enabling (for this to happen, we must first recreate the buffers)
1002+ Err = OMX_SendCommand(iOMXDecoder, OMX_CommandPortEnable, iPortIndexForDynamicReconfig, NULL);
1003+ if (Err != OMX_ErrorNone)
1004+ {
1005+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
1006+ (0, "PVMFOMXAudioDecNode::HandlePortReEnable() Port Reconfiguration -> problem sending Port Enable command at port %d", iPortIndexForDynamicReconfig));
1007+
1008+ SetState(EPVMFNodeError);
1009+ ReportErrorEvent(PVMFErrResource);
1010+ return PVMFErrResource;
1011+ }
1012+
9891013 /* Allocate output buffers */
9901014 if (!CreateOutMemPool(iNumOutputBuffers))
9911015 {
@@ -1029,6 +1053,7 @@ PVMFStatus PVMFOMXAudioDecNode::HandlePortReEnable()
10291053 else
10301054 {
10311055 // this is input port
1056+ uint32 iBeforeConfigNumInputBuffers = iNumInputBuffers;
10321057
10331058 // read the alignment again - just in case
10341059 iInputBufferAlignment = iParamPort.nBufferAlignment;
@@ -1045,6 +1070,41 @@ PVMFStatus PVMFOMXAudioDecNode::HandlePortReEnable()
10451070 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
10461071 (0, "PVMFOMXAudioDecNode::HandlePortReEnable() new buffers %d, size %d", iNumInputBuffers, iOMXComponentInputBufferSize));
10471072
1073+ if (iNumInputBuffers > iBeforeConfigNumInputBuffers)
1074+ {
1075+ //Reallocate EmptyBufferDone THREADSAFE CALLBACK AOs in case of port reconfiguration
1076+ if (iThreadSafeHandlerEmptyBufferDone)
1077+ {
1078+ OSCL_DELETE(iThreadSafeHandlerEmptyBufferDone);
1079+ iThreadSafeHandlerEmptyBufferDone = NULL;
1080+ }
1081+ // use the new queue depth of iNumInputBuffers to prevent deadlock
1082+ iThreadSafeHandlerEmptyBufferDone = OSCL_NEW(EmptyBufferDoneThreadSafeCallbackAO, (this, iNumInputBuffers, "EmptyBufferDoneAO", Priority() + 1));
1083+
1084+ if (NULL == iThreadSafeHandlerEmptyBufferDone)
1085+ {
1086+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
1087+ (0, "PVMFOMXAudioDecNode::HandlePortReEnable() Port Reconfiguration -> Can't reallocate EmptyBufferDone threadsafe callback queue!"));
1088+ SetState(EPVMFNodeError);
1089+ ReportErrorEvent(PVMFErrNoMemory);
1090+ return false;
1091+ }
1092+ }
1093+
1094+
1095+ // send command for port re-enabling (for this to happen, we must first recreate the buffers)
1096+ Err = OMX_SendCommand(iOMXDecoder, OMX_CommandPortEnable, iPortIndexForDynamicReconfig, NULL);
1097+ if (Err != OMX_ErrorNone)
1098+ {
1099+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
1100+ (0, "PVMFOMXAudioDecNode::HandlePortReEnable() Port Reconfiguration -> problem sending Port Enable command at port %d", iPortIndexForDynamicReconfig));
1101+
1102+ SetState(EPVMFNodeError);
1103+ ReportErrorEvent(PVMFErrResource);
1104+ return PVMFErrResource;
1105+ }
1106+
1107+
10481108 /* Allocate input buffers */
10491109 if (!CreateInputMemPool(iNumInputBuffers))
10501110 {
--- a/nodes/pvomxencnode/src/pvmf_omx_enc_node.cpp
+++ b/nodes/pvomxencnode/src/pvmf_omx_enc_node.cpp
@@ -1637,6 +1637,8 @@ PVMFStatus PVMFOMXEncNode::HandleProcessingState()
16371637 // is this output port?
16381638 if (iPortIndexForDynamicReconfig == iOutputPortIndex)
16391639 {
1640+ uint32 iBeforeConfigNumOutputBuffers = iNumOutputBuffers;
1641+
16401642 // check the new buffer size
16411643 iOMXComponentOutputBufferSize = iParamPort.nBufferSize;
16421644
@@ -1673,6 +1675,27 @@ PVMFStatus PVMFOMXEncNode::HandleProcessingState()
16731675 return PVMFFailure;
16741676 }
16751677
1678+ if (iNumOutputBuffers > iBeforeConfigNumOutputBuffers)
1679+ {
1680+ //Reallocate FillBufferDone THREADSAFE CALLBACK AOs in case of port reconfiguration
1681+ if (iThreadSafeHandlerFillBufferDone)
1682+ {
1683+ OSCL_DELETE(iThreadSafeHandlerFillBufferDone);
1684+ iThreadSafeHandlerFillBufferDone = NULL;
1685+ }
1686+ // use the new queue depth of iNumOutputBuffers to prevent deadlock
1687+ iThreadSafeHandlerFillBufferDone = OSCL_NEW(FillBufferDoneThreadSafeCallbackAOEnc, (this, iNumOutputBuffers, "FillBufferDoneAO", Priority() + 1));
1688+
1689+ if (NULL == iThreadSafeHandlerFillBufferDone)
1690+ {
1691+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
1692+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration ->Can't reallocate FillBufferDone threadsafe callback queue!", iNodeTypeId));
1693+ SetState(EPVMFNodeError);
1694+ ReportErrorEvent(PVMFErrNoMemory);
1695+ return false;
1696+ }
1697+ }
1698+
16761699 // send command for port re-enabling (for this to happen, we must first recreate the buffers)
16771700 Err = OMX_SendCommand(iOMXEncoder, OMX_CommandPortEnable, iPortIndexForDynamicReconfig, NULL);
16781701 if (OMX_ErrorNone != Err)
@@ -1723,6 +1746,8 @@ PVMFStatus PVMFOMXEncNode::HandleProcessingState()
17231746 {
17241747
17251748 // this is input port
1749+ uint32 iBeforeConfigNumInputBuffers = iNumInputBuffers;
1750+
17261751 // read the input port buffer alignment requirement
17271752 iInputBufferAlignment = iParamPort.nBufferAlignment;
17281753 iOMXComponentInputBufferSize = iParamPort.nBufferSize;
@@ -1759,6 +1784,27 @@ PVMFStatus PVMFOMXEncNode::HandleProcessingState()
17591784 return PVMFFailure;
17601785 }
17611786
1787+ if (iNumInputBuffers > iBeforeConfigNumInputBuffers)
1788+ {
1789+ //Reallocate EmptyBufferDone THREADSAFE CALLBACK AOs in case of port reconfiguration
1790+ if (iThreadSafeHandlerEmptyBufferDone)
1791+ {
1792+ OSCL_DELETE(iThreadSafeHandlerEmptyBufferDone);
1793+ iThreadSafeHandlerEmptyBufferDone = NULL;
1794+ }
1795+ // use the new queue depth of iNumInputBuffers to prevent deadlock
1796+ iThreadSafeHandlerEmptyBufferDone = OSCL_NEW(EmptyBufferDoneThreadSafeCallbackAOEnc, (this, iNumInputBuffers, "EmptyBufferDoneAO", Priority() + 1));
1797+
1798+ if (NULL == iThreadSafeHandlerEmptyBufferDone)
1799+ {
1800+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
1801+ (0, "PVMFOMXEncNode-%s::HandleProcessingState() Port Reconfiguration -> Can't reallocate EmptyBufferDone threadsafe callback queue!", iNodeTypeId));
1802+ SetState(EPVMFNodeError);
1803+ ReportErrorEvent(PVMFErrNoMemory);
1804+ return false;
1805+ }
1806+ }
1807+
17621808 // send command for port re-enabling (for this to happen, we must first recreate the buffers)
17631809 Err = OMX_SendCommand(iOMXEncoder, OMX_CommandPortEnable, iPortIndexForDynamicReconfig, NULL);
17641810 if (OMX_ErrorNone != Err)
--- a/nodes/pvomxvideodecnode/src/pvmf_omx_videodec_node.cpp
+++ b/nodes/pvomxvideodecnode/src/pvmf_omx_videodec_node.cpp
@@ -186,6 +186,7 @@ PVMFStatus PVMFOMXVideoDecNode::HandlePortReEnable()
186186 // is this output port?
187187 if (iPortIndexForDynamicReconfig == iOutputPortIndex)
188188 {
189+ uint32 iBeforeConfigNumOutputBuffers = iNumOutputBuffers;
189190
190191 // read the alignment
191192 iOutputBufferAlignment = iParamPort.nBufferAlignment;
@@ -421,6 +422,28 @@ PVMFStatus PVMFOMXVideoDecNode::HandlePortReEnable()
421422
422423 }
423424
425+
426+ if (iNumOutputBuffers > iBeforeConfigNumOutputBuffers)
427+ {
428+ //Reallocate FillBufferDone THREADSAFE CALLBACK AOs in case of port reconfiguration
429+ if (iThreadSafeHandlerFillBufferDone)
430+ {
431+ OSCL_DELETE(iThreadSafeHandlerFillBufferDone);
432+ iThreadSafeHandlerFillBufferDone = NULL;
433+ }
434+ // use the new queue depth of iNumOutputBuffers to prevent deadlock
435+ iThreadSafeHandlerFillBufferDone = OSCL_NEW(FillBufferDoneThreadSafeCallbackAO, (this, iNumOutputBuffers, "FillBufferDoneAO", Priority() + 1));
436+
437+ if (NULL == iThreadSafeHandlerFillBufferDone)
438+ {
439+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
440+ (0, "PVMFOMXVideoDecNode::HandlePortReEnable() Can't reallocate FillBufferDone threadsafe callback queue!"));
441+ SetState(EPVMFNodeError);
442+ ReportErrorEvent(PVMFErrNoMemory);
443+ return false;
444+ }
445+ }
446+
424447 // it is now safe to send command for port reenable
425448 // send command for port re-enabling (for this to happen, we must first recreate the buffers)
426449 Err = OMX_SendCommand(iOMXDecoder, OMX_CommandPortEnable, iPortIndexForDynamicReconfig, NULL);
@@ -474,6 +497,8 @@ PVMFStatus PVMFOMXVideoDecNode::HandlePortReEnable()
474497 }
475498 else
476499 {
500+ uint32 iBeforeConfigNumInputBuffers = iNumInputBuffers;
501+
477502 // read the alignment
478503 iInputBufferAlignment = iParamPort.nBufferAlignment;
479504
@@ -503,6 +528,28 @@ PVMFStatus PVMFOMXVideoDecNode::HandlePortReEnable()
503528 ReportErrorEvent(PVMFErrNoMemory);
504529 return false;
505530 }
531+
532+ if (iNumInputBuffers > iBeforeConfigNumInputBuffers)
533+ {
534+ //Reallocate EmptyBufferDone THREADSAFE CALLBACK AOs in case of port reconfiguration
535+ if (iThreadSafeHandlerEmptyBufferDone)
536+ {
537+ OSCL_DELETE(iThreadSafeHandlerEmptyBufferDone);
538+ iThreadSafeHandlerEmptyBufferDone = NULL;
539+ }
540+ // use the new queue depth of iNumInputBuffers to prevent deadlock
541+ iThreadSafeHandlerEmptyBufferDone = OSCL_NEW(EmptyBufferDoneThreadSafeCallbackAO, (this, iNumInputBuffers, "EmptyBufferDoneAO", Priority() + 1));
542+
543+ if (NULL == iThreadSafeHandlerEmptyBufferDone)
544+ {
545+ PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
546+ (0, "PVMFOMXVideoDecNode::HandlePortReEnable() Can't reallocate EmptyBufferDone threadsafe callback queue!"));
547+ SetState(EPVMFNodeError);
548+ ReportErrorEvent(PVMFErrNoMemory);
549+ return false;
550+ }
551+ }
552+
506553 // it is now safe to send command for port reenable
507554 // send command for port re-enabling (for this to happen, we must first recreate the buffers)
508555 Err = OMX_SendCommand(iOMXDecoder, OMX_CommandPortEnable, iPortIndexForDynamicReconfig, NULL);
Show on old repository browser