- Timestamp:
- Dec 12, 2018 7:16:46 AM (6 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/event.h
r5843 r5920 88 88 * RTCP-FB has been received. 89 89 */ 90 PJMEDIA_EVENT_RX_RTCP_FB = PJMEDIA_FOURCC('R', 'T', 'F', 'B') 90 PJMEDIA_EVENT_RX_RTCP_FB = PJMEDIA_FOURCC('R', 'T', 'F', 'B'), 91 92 /** 93 * Audio device stopped on error. 94 */ 95 PJMEDIA_EVENT_AUD_DEV_ERROR = PJMEDIA_FOURCC('A', 'E', 'R', 'R') 91 96 92 97 } pjmedia_event_type; … … 134 139 pj_bool_t cancel; 135 140 } pjmedia_event_wnd_closing_data; 141 142 /** 143 * Additional data/parameters for audio device error event. 144 */ 145 typedef struct pjmedia_event_aud_dev_err_data 146 { 147 /** The media direction that fails */ 148 pjmedia_dir dir; 149 150 /** The audio device ID */ 151 pjmedia_aud_dev_index id; 152 153 /** The error code */ 154 pj_status_t status; 155 } pjmedia_event_aud_dev_err_data; 136 156 137 157 /** Additional parameters for window changed event. */ … … 216 236 /** Keyframe missing event data */ 217 237 pjmedia_event_keyframe_missing_data keyframe_missing; 238 239 /** Audio device error event data */ 240 pjmedia_event_aud_dev_err_data aud_dev_err; 218 241 219 242 /** Storage for user event data */ -
pjproject/trunk/pjmedia/src/pjmedia-audiodev/wmme_dev.c
r5035 r5920 24 24 #include <pj/string.h> 25 25 #include <pj/unicode.h> 26 #include <pjmedia/event.h> 26 27 27 28 #if PJMEDIA_AUDIO_DEV_HAS_WMME … … 894 895 static unsigned rec_cnt, play_cnt; 895 896 enum { MAX_BURST = 1000 }; 897 pjmedia_dir signalled_dir = PJMEDIA_DIR_NONE; 896 898 897 899 /* Suppress compile warning for unused debugging vars */ … … 928 930 929 931 DWORD rc; 930 pjmedia_dir signalled_dir;931 932 932 933 /* Swap hWaveIn and hWaveOut to get equal opportunity for both */ … … 1047 1048 if (mr != MMSYSERR_NOERROR) { 1048 1049 status = PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(mr); 1050 PJ_PERROR(3, (THIS_FILE, status, 1051 "Failed to write audio frame for playback")); 1049 1052 break; 1050 1053 } … … 1149 1152 if (mr != MMSYSERR_NOERROR) { 1150 1153 status = PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_IN(mr); 1154 PJ_PERROR(3, (THIS_FILE, status, 1155 "Failed to add recording buffer")); 1151 1156 break; 1152 1157 } … … 1169 1174 1170 1175 PJ_LOG(5,(THIS_FILE, "WMME: thread stopping..")); 1176 1177 if (status != PJ_SUCCESS) { 1178 pjmedia_event e; 1179 pj_timestamp *ts; 1180 pjmedia_aud_param param; 1181 1182 PJ_PERROR(3, (THIS_FILE, status, "WMME thread stopped due to error")); 1183 1184 /* Broadcast WMME error */ 1185 pj_assert(signalled_dir != PJMEDIA_DIR_NONE); 1186 ts = (signalled_dir==PJMEDIA_DIR_PLAYBACK)? 1187 &strm->play_strm.timestamp : &strm->rec_strm.timestamp; 1188 pjmedia_event_init(&e, PJMEDIA_EVENT_AUD_DEV_ERROR, ts, &strm->base); 1189 e.data.aud_dev_err.dir = signalled_dir; 1190 e.data.aud_dev_err.status = status; 1191 e.data.aud_dev_err.id = PJMEDIA_AUD_INVALID_DEV; 1192 if (pjmedia_aud_stream_get_param(&strm->base, ¶m) == PJ_SUCCESS) { 1193 e.data.aud_dev_err.id = (signalled_dir==PJMEDIA_DIR_PLAYBACK)? 1194 param.play_id : param.rec_id; 1195 } 1196 1197 pjmedia_event_publish(NULL, &strm->base, &e, 1198 PJMEDIA_EVENT_PUBLISH_DEFAULT); 1199 } 1200 1171 1201 return 0; 1172 1202 } -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_aud.c
r5918 r5920 1948 1948 pjsua_var.snd_is_on = PJ_TRUE; 1949 1949 1950 /* Subscribe to audio device events */ 1951 pjmedia_event_subscribe(NULL, &call_media_on_event, NULL, 1952 pjmedia_snd_port_get_snd_stream(pjsua_var.snd_port)); 1953 1950 1954 pj_log_pop_indent(); 1951 1955 return PJ_SUCCESS; … … 1984 1988 "%s sound capture device", 1985 1989 play_info.name, cap_info.name)); 1990 1991 /* Unsubscribe from audio device events */ 1992 pjmedia_event_unsubscribe(NULL, &call_media_on_event, NULL, strm); 1986 1993 1987 1994 pjmedia_snd_port_disconnect(pjsua_var.snd_port); -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r5918 r5920 1427 1427 { 1428 1428 pjsua_call_media *call_med = (pjsua_call_media*)user_data; 1429 pjsua_call *call = call_med ->call;1429 pjsua_call *call = call_med? call_med->call : NULL; 1430 1430 pj_status_t status = PJ_SUCCESS; 1431 1431 … … 1471 1471 } 1472 1472 1473 if (pjsua_var.ua_cfg.cb.on_call_media_event && call) { 1474 (*pjsua_var.ua_cfg.cb.on_call_media_event)(call->index, 1475 call_med->idx, event); 1473 if (pjsua_var.ua_cfg.cb.on_call_media_event) { 1474 if (call) { 1475 (*pjsua_var.ua_cfg.cb.on_call_media_event)(call->index, 1476 call_med->idx, event); 1477 } else { 1478 /* Also deliver non call events such as audio device error */ 1479 (*pjsua_var.ua_cfg.cb.on_call_media_event)(PJSUA_INVALID_ID, 1480 0, event); 1481 } 1476 1482 } 1477 1483
Note: See TracChangeset
for help on using the changeset viewer.