Changes between Initial Version and Version 1 of Ticket #701


Ignore:
Timestamp:
Jan 20, 2009 6:08:54 PM (15 years ago)
Author:
nanang
Comment:

In r2426: Updated PA callbacks to check their thread registration status using both: manual flag and actual/TLS status.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #701 – Description

    initial v1  
    11Here is quoted report: 
    22 
    3 > We ran into a intermittent problem with memory corruption on the Windows version of the application, that we traced to sound stream handling in "pasound.c". 
    4 > 
    5 > For each call, the application is calling "pjmedia_snd_port_create()" at the start of the call and "pjmedia_snd_port_destroy()" at the end of the call. After the second call, the application got corrupted heap sections. 
    6 > 
    7 > We noticed that after the second call, the thread that is receiving sound frames by PortAudio through "PaPlayerCallback()" had an invalid structure in it's TLS when calling pj_thread_this(). On the second call, the thread was not being registered, so the initial thread register was referencing the memory pool of the first call. 
    8  
     3> We ran into a intermittent problem with memory corruption on the Windows version of the application, that we traced to sound stream handling in "pasound.c".[[BR]] 
     4>[[BR]] 
     5> For each call, the application is calling "pjmedia_snd_port_create()" at the start of the call and "pjmedia_snd_port_destroy()" at the end of the call. After the second call, the application got corrupted heap sections.[[BR]] 
     6>[[BR]] 
     7> We noticed that after the second call, the thread that is receiving sound frames by PortAudio through "PaPlayerCallback()" had an invalid structure in it's TLS when calling pj_thread_this(). On the second call, the thread was not being registered, so the initial thread register was referencing the memory pool of the first call.[[BR]] 
     8[[BR]] 
    99So, basically callback's thread cases to be handled are: 
    10 - The thread may be changed in the middle of a session, e.g: in MacOS it happens when plugging/unplugging headphone. 
    11 - The same thread may be reused in consecutive sessions. The first session will leave TLS set, but release the TLS data address, so the second session must re-register the callback's thread. 
     10 - The thread may be changed in the middle of a session, e.g: in MacOS it happens when plugging/unplugging headphone. 
     11 - The same thread may be reused in consecutive sessions. The first session will leave TLS set, but release the TLS data address, so the second session must re-register the callback's thread.