Problem with new box/algorithm

Come here to discuss about OpenViBE in general!
Post Reply
toncho11
Posts: 123
Joined: Tue Apr 19, 2011 7:58 pm

Problem with new box/algorithm

Post by toncho11 »

I am working with the box from Tutorial 2: http://openvibe.inria.fr/tutorial-2-imp ... -in-boxes/

In ovp_main I have:
OVP_Declare_New(OpenViBEPlugins::SignalProcessing::CBoxAlgorithmSignalMaximumDesc)

It can not create the algorithm:
m_pMatrixMaximumAlgorithm=&this->getAlgorithmManager().getAlgorithm(this->getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_MatrixMaximum));

Method: IPluginObjectT* CPluginManager::createPluginObjectT
File: ovkCPluginManager

Code: Select all

map < IPluginObjectDesc*, IPluginModule* >::const_iterator i;
	for(i=m_vPluginObjectDesc.begin(); i!=m_vPluginObjectDesc.end(); i++)
	{
		if(i->first->getCreatedClass()==CIdentifier(l_ui64TargetClassIdentifier))
		{
			l_pPluginObjectDesc=i->first;
		}
	}
	if(!l_pPluginObjectDesc)
	{
		return NULL;
	}
It goes into the return NULL and then crashes. It does not find l_ui64TargetClassIdentifier, but it should I suppose.

Any hints?

toncho11
Posts: 123
Joined: Tue Apr 19, 2011 7:58 pm

Re: Problem with new box/algorithm

Post by toncho11 »

Problem turn-up to be easily fixable.

Algorithms are registered the same ways as Boxes are:

#include "ovpCAlgorithmMatrixMaximum.h"

OVP_Declare_New(OpenViBEPlugins::SignalProcessing::CAlgorithmMatrixMaximumDesc)

in ovp_main.cpp

The "OVP_Declare_New" macro adds both types to the list of available boxes and algorithms.

toncho11
Posts: 123
Joined: Tue Apr 19, 2011 7:58 pm

Re: Problem with new box/algorithm

Post by toncho11 »

Hi again,

Unfortunately I still can not complete Tutorial 2 - MatrixMaximum

I get an access violation invalid memory read in the following code in ovkCAlgorithm.cpp (line:365) when I click on "Play" scenario:

My source is here: http://adastra.googlecode.com/svn/trunk ... nalMaximum
It includes: the box and algorithm from Tutorial 2 and the test scenario.

This is the problematic part:

Code: Select all

boolean CAlgorithm::process(void)
{
	__proxy_func_0__(process, "process callback", this->setAllOutputTriggers(false), this->setAllInputTriggers(false));
} 
I have replaced __proxy_func_0__ macro with a real function call, but still I can not figure-out which object is corrupted and when this is happening in the workflow.

The log from Microsoft Application verifier http://www.microsoft.com/download/en/de ... x?id=20028
shows this:

Code: Select all

First-chance exception at 0x73371ed7 in OpenViBE-designer-dynamic.exe: 0xC0000005: Access violation writing location 0x00000000.

<avrf:logEntry Time="2012-02-19 : 09:41:40" LayerName="Heaps" StopCode="0x13" Severity="Error">
  <avrf:message>First chance access violation for current stack trace.</avrf:message> 
  <avrf:parameter1>0 - Invalid address causing the exception.</avrf:parameter1> 
  <avrf:parameter2>73371ed7 - Code address executing the invalid access.</avrf:parameter2> 
  <avrf:parameter3>d2e760 - Exception record.</avrf:parameter3> 
  <avrf:parameter4>d2e7b0 - Context record.</avrf:parameter4> 
  <avrf:stackTrace>
  <avrf:trace>vrfcore!VfCoreRedirectedStopMessage+81 (d:\avrf\source\base\avrf\avrf30\vrfcore\stopredirect.cpp @ 103)</avrf:trace> 
  <avrf:trace>vfbasics!VerifierStopMessage+292 (d:\avrf\source\base\avrf\avrf30\providers\basics\basics.c @ 1214)</avrf:trace> 
  <avrf:trace>vfbasics!AVrfpCheckFirstChanceException+c8 (d:\avrf\source\base\avrf\vrfcommon\support.c @ 1108)</avrf:trace> 
  <avrf:trace>vfbasics!AVrfpVectoredExceptionHandler+16 (d:\avrf\source\base\avrf\vrfcommon\support.c @ 323)</avrf:trace> 
  <avrf:trace>ntdll!RtlGetProcessHeaps+49d ( @ 0)</avrf:trace> 
  <avrf:trace>ntdll!RtlCaptureContext+187 ( @ 0)</avrf:trace> 
  <avrf:trace>ntdll!LdrRemoveLoadAsDataTable+c0b ( @ 0)</avrf:trace> 
  <avrf:trace>ntdll!KiUserExceptionDispatcher+f ( @ 0)</avrf:trace> 
  </avrf:stackTrace>
</avrf:logEntry>
Full log from Application Verifier is attached.
Attachments
OpenViBE-designer-dynamic.exe.15.dat.zip
Full log from Application Verifier with the access violation error in the end.
(28.5 KiB) Downloaded 185 times

toncho11
Posts: 123
Joined: Tue Apr 19, 2011 7:58 pm

Re: Problem with new box/algorithm

Post by toncho11 »

I was able to load the debugging symbols for all required modules (dlls).

So problem turned up to be in:

void CStreamedMatrixDecoder::processChildData(const void* pBuffer, const EBML::uint64 ui64BufferSize)

where memcpy fails because destination is NULL.

Actually the problem is in the tutorial:

It says:

Code: Select all

ip_pMatrixMaximumAlgorithm_Matrix->setDimensionCount(3);
but this contradicts with:

Code: Select all

if( dimCount != 2)
{
	this->getLogManager() << LogLevel_Error << "The input matrix must have 2 dimensions";
	return false;
}
If I leave dimensions to 3 then the check above prevents the algorithm from doing any real work.

If I set dimensions to 2 then check is OK, but it terminates with the above error.

Which is the right way to code the tutorial?

lbonnet
Site Admin
Posts: 417
Joined: Wed Oct 07, 2009 12:11 pm

Re: Problem with new box/algorithm

Post by lbonnet »

Hi everyone !

The Tutorial has indeed a mistake.

Code: Select all

ip_pMatrixMaximumAlgorithm_Matrix->setDimensionCount(3);
Is totally irrelevant. This line should not be present... I added it to test the dimension verification in the Algorithm, and forgot to remove it when writing the tutorial on the website. My fault, sorry.
If I leave dimensions to 3 then the check above prevents the algorithm from doing any real work.

If I set dimensions to 2 then check is OK, but it terminates with the above error.
Indeed, happens to me also.
When you re-set the dimension count into a matrix, it gets re-initialized (buffer deleted, resized, etc.).
Simply delete the line:

Code: Select all

if(m_oSignalDecoder.isHeaderReceived())
{
    ip_pMatrixMaximumAlgorithm_Matrix->setDimensionCount(3);
    if(!m_pMatrixMaximumAlgorithm->process(OVP_Algorithm_MatrixMaximum_InputTriggerId_Initialize))
    {
        return false;
    }
    m_oSignalEncoder.encodeHeader(0);
    l_rDynamicBoxContext.markOutputAsReadyToSend(0, l_rDynamicBoxContext.getInputChunkStartTime(0, i),
                                                                l_rDynamicBoxContext.getInputChunkEndTime(0, i));
}
And it should be ok.

thank you for bringing this to our attention !

If you find another mistake in the tutorials or documentation, please tell us :)

Laurent-
Follow us on twitter >> openvibebci

Checkout my (old) blog for some OpenViBE tips & tricks : here !

toncho11
Posts: 123
Joined: Tue Apr 19, 2011 7:58 pm

Re: Problem with new box/algorithm

Post by toncho11 »

Hello Laurent,

Thank you for your feedback.

I removed:

Code: Select all

ip_pMatrixMaximumAlgorithm_Matrix->setDimensionCount(3);
What box do you use to visualize the output from SignalMaximum box? Is it a standard one - signal display?

These tutorials really help getting started with OpenVibe!

Cheers,
Anton

jlegeny
Posts: 239
Joined: Tue Nov 02, 2010 8:51 am
Location: Mensia Technologies Paris FR
Contact:

Re: Problem with new box/algorithm

Post by jlegeny »

As long as the output of a box is of type "signal" and is not epoched (by a previous epoching box) you can display it by a signal display box.

Post Reply