read_codec and write_codec are the current effective codecs.
real_read_codec and real_write_codec are the codecs set by the endpoint.

so when the endpoint sets the codec both read_codec and real_read_codec are the same
but if someone temporarily adds another codec like L16 to transcode to raw then the L16 codec object goes into read codec and the original codec remains at real_read_codec.

the raw and enc frames are internally used by the transcoding process to hold the encoded or decoded version of the current audio packet depending on the situation. 

media_bug is an object that can be attached to the session to install callbacks in the transcoding path so your code gets called one time per audio frame giving you a chance to inspect or alter the contents.  (see my cluecon 09 presentation video for detailed explanation)

The things in #4 are mostly related to controlling the session per second soft limits.
the mutexs you asked about are for specific things in the core

global_var_mutex protects global variables
global_mutex protects a whole bunch of infrequent operations that cannot occur at the same time.
throttle_mutex controls the access to the soft limit counter
sps is current sessions per second permitted
dummy_cng_frame is a global frame with the cng flag set which can be returned by the core read routine whenever it wants to send a cng frame.


I think the biggest focus should be on the switch_ivr family of files and any funcs used therein since that is the part of the api that most module programmers will need to use.  I guard the core with an evil 3 headed dog.



On Tue, Oct 13, 2009 at 2:26 AM, Muhammad Shahzad <shahzad@vopium.com> wrote:
Hi,

As i discussed in last week's conference call, i have some identifers in source code for which i couldn't guess their purpose and / or use. So, i am going to list such identifiers here (one file at a time) and request you to give me hints on these, so i can complete the doxygen documentation for them.

FILE: <FS-Trunk>/src/include/private/switch_core_pvt.h
==================================
1. In struct switch_core_session, what is the difference between read_codec and real_read_codec, similarly write_codec and real_write_codec?
2. In struct switch_core_session, what is the difference between raw_read_frame and enc_read_frame, similarly raw_write_frame and enc_write_frame?
3. What is struct switch_media_bug? I have some confusion ideas on it but better to know it from you.
4. In struct switch_runtime, variables offset, throttle_mutex, global_mutex (how it is different then global_var_mutex?), sps and dummy_cng_frame?

Thank you.


--
________________________________________________________
|                                                                                                |
| FATAL ERROR                                                           --- O X |
|_______________________________________________________|
|                        You have moved the mouse.                            |
| Windows must be restarted for the changes to take effect.   |
|                                        <OK>                                              |
####################################/


Muhammad Shahzad
-----------------------------------
CISCO Rich Media Communication Specialist (CRMCS)
CISCO Certified Network Associate (CCNA)
Cell: +92 334 422 40 88
MSN: shari_786pk@hotmail.com
Email: shaheryarkh@googlemail.com

_______________________________________________
FreeSWITCH-dev mailing list
FreeSWITCH-dev@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
http://www.freeswitch.org




--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org
pstn:213-799-1400