Changeset 5717 for pjproject/trunk/pjsip/src/pjsua2/media.cpp
- Timestamp:
- Dec 19, 2017 1:45:37 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua2/media.cpp
r5654 r5717 1029 1029 } 1030 1030 1031 1032 /////////////////////////////////////////////////////////////////////////////// 1033 ExtraAudioDevice::ExtraAudioDevice (int playdev, int recdev) : 1034 playDev(playdev), recDev(recdev), ext_snd_dev(NULL) 1035 { 1036 } 1037 1038 ExtraAudioDevice::~ExtraAudioDevice() 1039 { 1040 close(); 1041 } 1042 1043 void ExtraAudioDevice::open() 1044 { 1045 pj_status_t status; 1046 1047 /* Opened already? */ 1048 if (isOpened()) 1049 return; 1050 1051 /* Get port info of conference bridge master port */ 1052 pjsua_conf_port_info master_info; 1053 status = pjsua_conf_get_port_info(0, &master_info); 1054 PJSUA2_CHECK_RAISE_ERROR(status); 1055 1056 /* Generate sound device port param */ 1057 pjmedia_snd_port_param param; 1058 pjmedia_snd_port_param_default(¶m); 1059 1060 status = pjmedia_aud_dev_default_param(recDev, ¶m.base); 1061 PJSUA2_CHECK_RAISE_ERROR(status); 1062 1063 param.base.dir = PJMEDIA_DIR_CAPTURE_PLAYBACK; 1064 param.base.play_id = playDev; 1065 param.base.rec_id = recDev; 1066 param.base.clock_rate = master_info.clock_rate; 1067 param.base.channel_count = master_info.channel_count; 1068 param.base.samples_per_frame = master_info.samples_per_frame; 1069 param.base.bits_per_sample = master_info.bits_per_sample; 1070 1071 /* Create the extra sound device */ 1072 pjsua_ext_snd_dev *snd_dev; 1073 status = pjsua_ext_snd_dev_create(¶m, &snd_dev); 1074 PJSUA2_CHECK_RAISE_ERROR(status); 1075 ext_snd_dev = snd_dev; 1076 1077 /* Register to the conference bridge */ 1078 registerMediaPort(NULL); 1079 id = pjsua_ext_snd_dev_get_conf_port(snd_dev); 1080 } 1081 1082 bool ExtraAudioDevice::isOpened() 1083 { 1084 return (id != PJSUA_INVALID_ID); 1085 } 1086 1087 void ExtraAudioDevice::close() 1088 { 1089 /* Unregister from the conference bridge */ 1090 id = PJSUA_INVALID_ID; 1091 unregisterMediaPort(); 1092 1093 /* Destroy the extra sound device */ 1094 if (ext_snd_dev) { 1095 pjsua_ext_snd_dev *snd_dev = (pjsua_ext_snd_dev*)ext_snd_dev; 1096 ext_snd_dev = NULL; 1097 pjsua_ext_snd_dev_destroy(snd_dev); 1098 } 1099 } 1100 1031 1101 /////////////////////////////////////////////////////////////////////////////// 1032 1102 VideoWindow::VideoWindow(pjsua_vid_win_id win_id)
Note: See TracChangeset
for help on using the changeset viewer.