Changeset 4982
- Timestamp:
- Feb 11, 2015 5:15:29 AM (10 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/sound_port.h
r4082 r4982 96 96 */ 97 97 unsigned ec_options; 98 99 /** 100 * Arbitrary user data for playback and record preview callbacks below. 101 */ 102 void *user_data; 103 104 /** 105 * Optional callback for audio frame preview right before queued to 106 * the speaker. 107 * Notes: 108 * - application MUST NOT block or perform long operation in the callback 109 * as the callback may be executed in sound device thread 110 * - when using software echo cancellation, application MUST NOT modify 111 * the audio data from within the callback, otherwise the echo canceller 112 * will not work properly. 113 * - the return value of the callback will be ignored 114 */ 115 pjmedia_aud_play_cb on_play_frame; 116 117 /** 118 * Optional callback for audio frame preview recorded from the microphone 119 * before being processed by any media component such as software echo 120 * canceller. 121 * Notes: 122 * - application MUST NOT block or perform long operation in the callback 123 * as the callback may be executed in sound device thread 124 * - when using software echo cancellation, application MUST NOT modify 125 * the audio data from within the callback, otherwise the echo canceller 126 * will not work properly. 127 * - the return value of the callback will be ignored 128 */ 129 pjmedia_aud_rec_cb on_rec_frame; 98 130 99 131 } pjmedia_snd_port_param; -
pjproject/trunk/pjmedia/src/pjmedia/sound_port.c
r4537 r4982 62 62 unsigned ec_suspend_count; 63 63 unsigned ec_suspend_limit; 64 65 /* audio frame preview callbacks */ 66 void *user_data; 67 pjmedia_aud_play_cb on_play_frame; 68 pjmedia_aud_rec_cb on_rec_frame; 64 69 }; 65 70 … … 101 106 } 102 107 108 /* Invoke preview callback */ 109 if (snd_port->on_play_frame) 110 (*snd_port->on_play_frame)(snd_port->user_data, frame); 103 111 104 112 return PJ_SUCCESS; … … 121 129 } 122 130 131 /* Invoke preview callback */ 132 if (snd_port->on_play_frame) 133 (*snd_port->on_play_frame)(snd_port->user_data, frame); 134 123 135 return PJ_SUCCESS; 124 136 } … … 135 147 136 148 pjmedia_clock_src_update(&snd_port->cap_clocksrc, &frame->timestamp); 149 150 /* Invoke preview callback */ 151 if (snd_port->on_rec_frame) 152 (*snd_port->on_rec_frame)(snd_port->user_data, frame); 137 153 138 154 port = snd_port->port; … … 167 183 pjmedia_port_get_frame(port, frame); 168 184 185 /* Invoke preview callback */ 186 if (snd_port->on_play_frame) 187 (*snd_port->on_play_frame)(snd_port->user_data, frame); 188 169 189 return PJ_SUCCESS; 170 190 } … … 179 199 pjmedia_snd_port *snd_port = (pjmedia_snd_port*) user_data; 180 200 pjmedia_port *port; 201 202 /* Invoke preview callback */ 203 if (snd_port->on_rec_frame) 204 (*snd_port->on_rec_frame)(snd_port->user_data, frame); 181 205 182 206 port = snd_port->port; … … 465 489 snd_port->options = prm->options; 466 490 snd_port->prm_ec_options = prm->ec_options; 491 snd_port->user_data = prm->user_data; 492 snd_port->on_play_frame = prm->on_play_frame; 493 snd_port->on_rec_frame = prm->on_rec_frame; 467 494 468 495 ptime_usec = prm->base.samples_per_frame * 1000 / prm->base.channel_count / -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r4957 r4982 5812 5812 */ 5813 5813 pj_bool_t no_rtcp_sdes_bye; 5814 5815 /** 5816 * Optional callback for audio frame preview right before queued to 5817 * the speaker. 5818 * Notes: 5819 * - application MUST NOT block or perform long operation in the callback 5820 * as the callback may be executed in sound device thread 5821 * - when using software echo cancellation, application MUST NOT modify 5822 * the audio data from within the callback, otherwise the echo canceller 5823 * will not work properly. 5824 */ 5825 void (*on_aud_prev_play_frame)(pjmedia_frame *frame); 5826 5827 /** 5828 * Optional callback for audio frame preview recorded from the microphone 5829 * before being processed by any media component such as software echo 5830 * canceller. 5831 * Notes: 5832 * - application MUST NOT block or perform long operation in the callback 5833 * as the callback may be executed in sound device thread 5834 * - when using software echo cancellation, application MUST NOT modify 5835 * the audio data from within the callback, otherwise the echo canceller 5836 * will not work properly. 5837 */ 5838 void (*on_aud_prev_rec_frame)(pjmedia_frame *frame); 5814 5839 }; 5815 5840 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_aud.c
r4857 r4982 1678 1678 } 1679 1679 1680 static pj_status_t on_aud_prev_play_frame(void *user_data, pjmedia_frame *frame) 1681 { 1682 PJ_UNUSED_ARG(user_data); 1683 (*pjsua_var.media_cfg.on_aud_prev_play_frame)(frame); 1684 return PJ_SUCCESS; 1685 } 1686 1687 static pj_status_t on_aud_prev_rec_frame(void *user_data, pjmedia_frame *frame) 1688 { 1689 PJ_UNUSED_ARG(user_data); 1690 (*pjsua_var.media_cfg.on_aud_prev_rec_frame)(frame); 1691 return PJ_SUCCESS; 1692 } 1693 1680 1694 /* Open sound device with the setting. */ 1681 1695 static pj_status_t open_snd_dev(pjmedia_snd_port_param *param) … … 1705 1719 PJ_ASSERT_RETURN(pjsua_var.snd_pool, PJ_ENOMEM); 1706 1720 1721 /* Setup preview callbacks, if configured */ 1722 if (pjsua_var.media_cfg.on_aud_prev_play_frame) 1723 param->on_play_frame = &on_aud_prev_play_frame; 1724 if (pjsua_var.media_cfg.on_aud_prev_rec_frame) 1725 param->on_rec_frame = &on_aud_prev_rec_frame; 1707 1726 1708 1727 PJ_LOG(4,(THIS_FILE, "Opening sound device %s@%d/%d/%dms",
Note: See TracChangeset
for help on using the changeset viewer.