Audio Pre-Processing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This may be all I need:

norman:~/src/pjproject-svn franke$ svn diff
Index: pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- pjsip/include/pjsua-lib/pjsua.h     (revision 1805)
+++ pjsip/include/pjsua-lib/pjsua.h     (working copy)
@@ -922,6 +922,19 @@
       */
      void (*on_nat_detect)(const pj_stun_nat_detect_result *res);

+    /** Notify application when media session is created and before
+     *  it is registered to the conference bridge. Application may  
return
+     *  different media port if it has added media processing port to
+     *  the stream.
+     */
+     void (*on_stream_created)(pjsua_call_id call_id,  
pjmedia_session *sess,
+                              unsigned stream_idx, pjmedia_port  
**p_port);
+
+    /** Notify application when media session is about to be destroyed.
+     */
+     void (*on_stream_destroyed)(pjsua_call_id call_id,
+                                pjmedia_session *sess, unsigned  
stream_idx);
+
  } pjsua_callback;


Index: pjsip/src/pjsua-lib/pjsua_media.c
===================================================================
--- pjsip/src/pjsua-lib/pjsua_media.c   (revision 1805)
+++ pjsip/src/pjsua-lib/pjsua_media.c   (working copy)
@@ -881,6 +881,9 @@
      pjsua_call *call = &pjsua_var.calls[call_id];

      if (call->conf_slot != PJSUA_INVALID_ID) {
+       if (pjsua_var.ua_cfg.cb.on_stream_destroyed) {
+           pjsua_var.ua_cfg.cb.on_stream_destroyed(call_id, call- 
 >session, 0);
+       }
         pjmedia_conf_remove_port(pjsua_var.mconf, call->conf_slot);
         call->conf_slot = PJSUA_INVALID_ID;
      }
@@ -1064,7 +1067,13 @@
         {
             char tmp[PJSIP_MAX_URL_SIZE];
             pj_str_t port_name;
+           pjmedia_port *conf_media_port = media_port;

+           if (pjsua_var.ua_cfg.cb.on_stream_created) {
+               pjsua_var.ua_cfg.cb.on_stream_created(
+                               call_id, call->session, 0,  
&conf_media_port);
+           }
+
             port_name.ptr = tmp;
             port_name.slen = pjsip_uri_print(PJSIP_URI_IN_REQ_URI,
                                              call->inv->dlg- 
 >remote.info->uri,
@@ -1073,7 +1082,7 @@
                 port_name = pj_str("call");
             }
             status = pjmedia_conf_add_port( pjsua_var.mconf, call- 
 >inv->pool,
-                                           media_port,
+                                           conf_media_port,
                                             &port_name,
                                             (unsigned*)&call- 
 >conf_slot);
             if (status != PJ_SUCCESS) {


Norman Franke
Answering Service for Directors, Inc.
www.myasd.com

On Feb 19, 2008, at 3:40 AM, Benny Prijono wrote:

> On 2/18/08, Norman Franke <norman at myasd.com> wrote:
>>  I'm using the PJSUA library, and I want to intercept audio from  
>> remote
>> callers and process it before mixing in the conference bridge.  
>> What's the
>> best way to do this? I want to add some type of dynamic gain  
>> control, since
>> we get some very soft callers. I've done something similar for  
>> playback of
>> files and that works great, so now I want to do so with callers.
>>
>
> Currently there's no way to do that with PJSUA-LIB, as stream will be
> added to the conference bridge automatically. But perhaps this would
> be simple to support by adding couple of callbacks below in
> pjsua_callback:
>
> /** Notify application when media session is created and before
>  *  it is registered to the conference bridge. Application may return
>  *  different media port if it has added media processing port to
>  *  the stream.
>  */
>  void (*on_stream_created)(pjsua_call_id call_id, pjmedia_session  
> *sess,
>                                         unsigned stream_idx,
> pjmedia_port **p_port);
>
> /** Notify application when media session is about to be destroyed.
>  */
>  void (*on_stream_destroyed)(pjsua_call_id call_id,
>                                            pjmedia_session *sess,
>                                            unsigned stream_idx);
>
>
> This would also fix the problem discussed in "stream port destroyed
> before callback function was called" thread.
>
> Now, care to make patch? ;-)
>
> cheers,
>  -benny
>
>>
>> Norman Franke
>> Answering Service for Directors, Inc.
>> www.myasd.com
>>
>> _______________________________________________
>> Visit our blog: http://blog.pjsip.org
>>
>> pjsip mailing list
>> pjsip at lists.pjsip.org
>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>
>>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080219/5b48dd2a/attachment-0001.html 


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux