Return to LanScape's home page Go back a page...       Active TopicsActive Topics   Display List of Forum MembersMember List   Knowledge Base SearchSearch   HelpHelp  RegisterRegister  LoginLogin

LanScape VOIP Media Engine™ - Technical Support
 LanScape Support Forum -> LanScape VOIP Media Engine™ - Technical Support
Subject Topic: Errors with CloseWaveFile Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Cwilson
Intermediate
Intermediate


Joined: August 10 2012
Location: United Kingdom
Posts: 25
Posted: April 10 2013 at 10:18am | IP Logged Quote Cwilson

I'm using a class based on the TEST_TX_IVR chunk of the
console test example to stream wave data over a phone
line.

I start this class on a new thread, and tell it to stream
various wave files over the phone line and then let the
application know when it's done.

This was fine until I started using the following code to
stop the wave file transmission before the end of the
wave file.

        public void StopWav()
        {
            _continuePlaying = false;
            TxIvrChannel.StopIvrTransmit();
            TxIvrChannel.CloseTxIvrChannel();
            WaveFileObj.CloseWaveFile();
            // Let the call handler know that we're done.
            if (StreamingCompleted != null)
               StreamingCompleted();
        }


My problem is that when I call CloseWaveFile(), I
sometimes get a AccessViolationException thrown, or a
FileAccessException.

Any ideas on what I'm doing wrong?
Back to Top View Cwilson's Profile Search for other posts by Cwilson
 
support
Administrator
Administrator


Joined: January 26 2005
Location: United States
Posts: 1666
Posted: April 10 2013 at 12:18pm | IP Logged Quote support


Without seeing your call stack, specific exception error information or other debugging related info, I am not sure why you are seeing a problem.

Questions:
1) Do you open and then close the wave file on the same thread?

2) Is the wave file possibly being closed more than once?

3) IMPORTANT: Is it possible that the wave file object is being collected by the managed code garbage collector while you are trying to also close the wave file?


One thing I do see is this: It is good to wait for the tx ivr channel to complete before closing it. Here’s your modified code:

Code:

public void StopWav() 

     _continuePlaying = false; 
     
     TxIvrChannel.StopIvrTransmit(); 
     
     // wait for Tx ivr to complete before closing the channel.
     TxIvrChannel.WaitForIvrTransmitComplete()

     TxIvrChannel.CloseTxIvrChannel(); 
     WaveFileObj.CloseWaveFile(); 
     
     // Let the call handler know that we're done. 
     if (StreamingCompleted != null) 
          StreamingCompleted(); 
}



Other possible things to do:
1) Post your specific exception information to this thread.

2) Post your call stack at the time the exception gets caught.

I will see if I can quickly spot a problem but keep in mind that we cannot help debug user code or applications without paid support. With paid support, there is no limit to how I am able to assist you.


RJ


Back to Top View support's Profile Search for other posts by support Visit support's Homepage
 
Cwilson
Intermediate
Intermediate


Joined: August 10 2012
Location: United Kingdom
Posts: 25
Posted: April 18 2013 at 5:24am | IP Logged Quote Cwilson

support wrote:

Questions:
1) Do you open and then close the wave file on the same
thread?

2) Is the wave file possibly being closed more than once?

3) IMPORTANT: Is it possible that the
wave file object is being collected by the managed code
garbage collector while you are trying to also close the
wave file?


1) No. This turned out to be the problem. Closing the
file from the same thread that spawned it fixed the
problem.

This turned out to be one of those dumb problems that you
immediately fix as soon as you go asking for technical
support.

Back to Top View Cwilson's Profile Search for other posts by Cwilson
 
support
Administrator
Administrator


Joined: January 26 2005
Location: United States
Posts: 1666
Posted: April 18 2013 at 10:15am | IP Logged Quote support


Very glad you identified the issue. Nicely done.

RJ

Back to Top View support's Profile Search for other posts by support Visit support's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum






Contact LanScape Hear what the Lawyers have to say How youm may use this site Read your privacy rights