Changeset 5728
- Timestamp:
- Jan 18, 2018 4:02:00 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/opus.c
r5659 r5728 933 933 pjmedia_frame *inframe; 934 934 int fec = 0; 935 int frm_size; 935 936 936 937 PJ_UNUSED_ARG(output_buf_len); … … 969 970 pj_memcpy(inframe->buf, input->buf, input->size); 970 971 fec = 1; 971 } 972 973 decoded_samples = opus_decode(opus_data->dec, 972 } 973 974 /* From Opus doc: In the case of PLC (data==NULL) or FEC(decode_fec=1), 975 * then frame_size needs to be exactly the duration of audio that 976 * is missing. 977 */ 978 if (inframe->type != PJMEDIA_FRAME_TYPE_AUDIO || fec) { 979 frm_size = opus_data->cfg.sample_rate * opus_data->ptime / 1000; 980 } else { 981 frm_size = output->size / (sizeof(opus_int16) * 982 opus_data->cfg.channel_cnt); 983 } 984 decoded_samples = opus_decode( opus_data->dec, 974 985 inframe->type==PJMEDIA_FRAME_TYPE_AUDIO ? 975 986 inframe->buf : NULL, … … 977 988 inframe->size : 0, 978 989 (opus_int16*)output->buf, 979 output->size / (sizeof(opus_int16) * 980 opus_data->cfg.channel_cnt), 990 frm_size, 981 991 fec); 982 992 output->timestamp = inframe->timestamp; 983 993 984 994 if (inframe->type == PJMEDIA_FRAME_TYPE_AUDIO) { 985 995 /* Mark current indexed frame as invalid */ 986 996 inframe->type = PJMEDIA_FRAME_TYPE_NONE; … … 1022 1032 int decoded_samples; 1023 1033 pjmedia_frame *inframe; 1034 int frm_size; 1024 1035 1025 1036 PJ_UNUSED_ARG(output_buf_len); … … 1040 1051 1041 1052 inframe = &opus_data->dec_frame[opus_data->dec_frame_index]; 1053 if (inframe->type != PJMEDIA_FRAME_TYPE_AUDIO) { 1054 frm_size = opus_data->cfg.sample_rate * opus_data->ptime/1000; 1055 } else { 1056 frm_size = output->size / (sizeof(opus_int16) * 1057 opus_data->cfg.channel_cnt); 1058 } 1042 1059 decoded_samples = opus_decode(opus_data->dec, 1043 1060 inframe->type==PJMEDIA_FRAME_TYPE_AUDIO ? … … 1046 1063 inframe->size : 0, 1047 1064 (opus_int16*)output->buf, 1048 output->size / (sizeof(opus_int16) * 1049 opus_data->cfg.channel_cnt), 1065 frm_size, 1050 1066 0); 1051 1067
Note: See TracChangeset
for help on using the changeset viewer.