Changeset 411 for pjproject/trunk/pjmedia/src/pjmedia/stream.c
- Timestamp:
- Apr 27, 2006 10:36:40 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r408 r411 159 159 struct pjmedia_frame frame_in, frame_out; 160 160 161 /* Return no frame is channel is paused */ 162 if (channel->paused) { 163 frame->type = PJMEDIA_FRAME_TYPE_NONE; 164 return PJ_SUCCESS; 165 } 166 161 167 /* Lock jitter buffer mutex */ 162 168 pj_mutex_lock( stream->jb_mutex ); … … 175 181 return PJ_SUCCESS; 176 182 } 177 178 183 179 184 /* Decode */ … … 321 326 int rtphdrlen; 322 327 pj_ssize_t sent; 328 329 330 /* Don't do anything if stream is paused */ 331 if (channel->paused) 332 return PJ_SUCCESS; 333 323 334 324 335 /* Number of samples in the frame */ … … 758 769 /* Allocate buffer for decoding to PCM: */ 759 770 760 channel->pcm_buf_size = codec_param->sample_rate * 771 channel->pcm_buf_size = codec_param->clock_rate * 772 codec_param->channel_cnt * 761 773 codec_param->pcm_bits_per_sample / 8 * 762 774 PJMEDIA_MAX_FRAME_DURATION_MS / 1000; … … 791 803 pj_ioqueue_callback ioqueue_cb; 792 804 pj_uint16_t rtcp_port; 805 unsigned jbuf_init, jbuf_max; 793 806 pj_status_t status; 794 807 … … 814 827 stream->port.info.pt = info->fmt.pt; 815 828 pj_strdup(pool, &stream->port.info.encoding_name, &info->fmt.encoding_name); 816 stream->port.info.c hannel_count = 1;817 stream->port.info. sample_rate = info->fmt.sample_rate;829 stream->port.info.clock_rate = info->fmt.clock_rate; 830 stream->port.info.channel_count = info->fmt.channel_cnt; 818 831 stream->port.user_data = stream; 819 832 stream->port.put_frame = &put_frame; … … 832 845 stream->rem_rtcp_addr.sin_port = pj_htons(rtcp_port); 833 846 stream->rtcp_interval = (PJMEDIA_RTCP_INTERVAL + (pj_rand() % 8000)) * 834 info->fmt. sample_rate / 1000;847 info->fmt.clock_rate / 1000; 835 848 836 849 stream->tx_event_pt = info->tx_event_pt ? info->tx_event_pt : -1; … … 856 869 /* Get default codec param: */ 857 870 858 status = stream->codec->op->default_attr(stream->codec, &codec_param); 871 //status = stream->codec->op->default_attr(stream->codec, &codec_param); 872 status = pjmedia_codec_mgr_get_default_param( stream->codec_mgr, 873 &info->fmt, &codec_param); 859 874 if (status != PJ_SUCCESS) 860 875 goto err_cleanup; … … 862 877 /* Set additional info. */ 863 878 stream->port.info.bits_per_sample = 16; 864 stream->port.info.samples_per_frame = info->fmt. sample_rate*codec_param.ptime/1000;879 stream->port.info.samples_per_frame = info->fmt.clock_rate*codec_param.ptime/1000; 865 880 stream->port.info.bytes_per_frame = codec_param.avg_bps/8 * codec_param.ptime/1000; 866 881 … … 881 896 882 897 pjmedia_rtcp_init(&stream->rtcp, stream->port.info.name.ptr, 883 info->fmt. sample_rate,898 info->fmt.clock_rate, 884 899 stream->port.info.samples_per_frame, 885 900 info->ssrc); … … 887 902 888 903 /* Create jitter buffer: */ 889 904 jbuf_init = 100 / (stream->port.info.samples_per_frame * 1000 / 905 info->fmt.clock_rate); 906 jbuf_max = 600 / (stream->port.info.samples_per_frame * 1000 / 907 info->fmt.clock_rate); 890 908 status = pjmedia_jbuf_create(pool, &stream->port.info.name, 891 stream->frame_size, 15, 100, 909 stream->frame_size, 910 jbuf_init, jbuf_max, 892 911 &stream->jb); 893 912 if (status != PJ_SUCCESS)
Note: See TracChangeset
for help on using the changeset viewer.