Changeset 417 for pjproject/trunk
- Timestamp:
- Apr 28, 2006 2:48:02 PM (19 years ago)
- Location:
- pjproject/trunk/pjmedia
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/build/Makefile
r413 r417 67 67 clock_thread.o codec.o conference.o endpoint.o errno.o \ 68 68 wav_player.o wav_writer.o g711.o jbuf.o \ 69 master_port.o null_port.o port.o resample.o \ 69 master_port.o null_port.o plc_common.o plc_g711.o \ 70 port.o resample.o \ 70 71 resample_port.o rtcp.o rtp.o sdp.o sdp_cmp.o sdp_neg.o \ 71 72 session.o silencedet.o sound_port.o stream.o wave.o \ -
pjproject/trunk/pjmedia/build/pjmedia.dsp
r411 r417 136 136 # Begin Source File 137 137 138 SOURCE=..\src\pjmedia\plc_common.c 139 # End Source File 140 # Begin Source File 141 142 SOURCE=..\src\pjmedia\plc_g711.c 143 # End Source File 144 # Begin Source File 145 138 146 SOURCE=..\src\pjmedia\port.c 139 147 # End Source File … … 245 253 246 254 SOURCE=..\include\pjmedia.h 255 # End Source File 256 # Begin Source File 257 258 SOURCE=..\include\pjmedia\plc.h 247 259 # End Source File 248 260 # Begin Source File -
pjproject/trunk/pjmedia/include/pjmedia.h
r411 r417 35 35 #include <pjmedia/master_port.h> 36 36 #include <pjmedia/null_port.h> 37 #include <pjmedia/plc.h> 37 38 #include <pjmedia/port.h> 38 39 #include <pjmedia/resample.h> -
pjproject/trunk/pjmedia/include/pjmedia/config.h
r394 r417 118 118 119 119 120 /** 121 * G.711 Appendix I Packet Lost Concealment (PLC). 122 * Enabled only when floating point is enabled. 123 */ 124 #ifndef PJMEDIA_HAS_G711_PLC 125 # define PJMEDIA_HAS_G711_PLC PJ_HAS_FLOATING_POINT 126 #endif 127 128 129 120 130 #endif /* __PJMEDIA_CONFIG_H__ */ 121 131 -
pjproject/trunk/pjmedia/src/pjmedia/sound_port.c
r415 r417 19 19 #include <pjmedia/sound_port.h> 20 20 #include <pjmedia/errno.h> 21 #include <pjmedia/plc.h> 21 22 #include <pj/assert.h> 22 23 #include <pj/log.h> … … 25 26 26 27 27 //#define SIMULATE_LOST_PCT 1028 //#define SIMULATE_LOST_PCT 20 28 29 29 30 … … 35 36 }; 36 37 37 #define DEFAULT_OPTIONS PJMEDIA_PLC_ENABLED38 38 //#define DEFAULT_OPTIONS PJMEDIA_PLC_ENABLED 39 #define DEFAULT_OPTIONS 0 39 40 40 41 … … 48 49 unsigned options; 49 50 50 void *last_frame; 51 unsigned last_frame_size; 52 unsigned last_replay_count; 51 pjmedia_plc *plc; 53 52 54 53 unsigned clock_rate; … … 104 103 #endif 105 104 106 /* Keep frame if PLC is enabled. */ 107 if (snd_port->options & PJMEDIA_PLC_ENABLED) { 108 /* Must have the same length as last_frame_size */ 109 pj_assert(frame.size == snd_port->last_frame_size); 110 111 /* Copy frame to last_frame */ 112 pj_memcpy(snd_port->last_frame, output, snd_port->last_frame_size); 113 114 snd_port->last_replay_count = 0; 115 } 105 if (snd_port->plc) 106 pjmedia_plc_save(snd_port->plc, output); 116 107 117 108 return PJ_SUCCESS; … … 119 110 no_frame: 120 111 121 /* Replay last frame if PLC is enabled */ 122 if ((snd_port->options & PJMEDIA_PLC_ENABLED) && 123 snd_port->last_replay_count < 8) 124 { 125 126 /* Must have the same length as last_frame_size */ 127 pj_assert(size == snd_port->last_frame_size); 128 129 /* Replay last frame */ 130 pj_memcpy(output, snd_port->last_frame, snd_port->last_frame_size); 131 132 /* Reduce replay frame signal level to half */ 133 if (snd_port->bits_per_sample == 16) { 134 unsigned i, count; 135 pj_int16_t *samp; 136 137 count = snd_port->last_frame_size / 2; 138 samp = (pj_int16_t *) snd_port->last_frame; 139 140 for (i=0; i<count; ++i) 141 samp[i] = (pj_int16_t) (samp[i] >> 2); 142 143 } 144 112 /* Apply PLC */ 113 if (snd_port->plc) { 114 115 pjmedia_plc_generate(snd_port->plc, output); 145 116 #ifdef SIMULATE_LOST_PCT 146 PJ_LOG(4,(THIS_FILE, " Frame replayed"));117 PJ_LOG(4,(THIS_FILE, "Lost frame generated")); 147 118 #endif 148 149 ++snd_port->last_replay_count;150 151 } else {152 153 /* Just zero the frame */154 pj_memset(output, 0, size);155 156 119 } 157 120 … … 255 218 (snd_port->options & PJMEDIA_PLC_ENABLED)) 256 219 { 257 258 snd_port->last_frame_size = snd_port->samples_per_frame *259 snd_port->channel_count *260 snd_port->bits_per_sample / 8;261 snd_port->last_frame = pj_pool_zalloc(pool,262 snd_port->last_frame_size);220 status = pjmedia_plc_create(pool, snd_port->clock_rate, 221 snd_port->samples_per_frame * 222 snd_port->channel_count, 223 0, &snd_port->plc); 224 if (status != PJ_SUCCESS) 225 snd_port->plc = NULL; 263 226 } 264 227
Note: See TracChangeset
for help on using the changeset viewer.