Sanjivkumarroshan / csipsimple

Automatically exported from code.google.com/p/csipsimple
0 stars 0 forks source link

Choppy Opus audio #2868

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use Opus
2.
3.

What is the expected output? What do you see instead?
with SILK I get OK sound, but with Opus the audio is choppy.

because of "Issue attachment storage quota exceeded", here's a link:
https://drive.google.com/file/d/0B_EMXtsx7o56ZnY2djZRS05DUlk/view?usp=sharing

I wonder if my ZTE Blade III (cyanogenmod 11) is too slow. The other end has 
Nexus 5 (Lollipop).

If CPU is too slow, csipsimple should run performance test on startup.

Original issue reported on code.google.com by hvtaifwk...@gmail.com on 10 Jan 2015 at 10:02

GoogleCodeExporter commented 9 years ago
Sounds like problems I had with compatibility of older version of Opus spec. 
Are both devices using the very latest opus plugin version? Also, is there a 
sip server in the middle?

Original comment by r3gis...@gmail.com on 18 Jan 2015 at 7:13

GoogleCodeExporter commented 9 years ago
Both devices have the latest codec pack from Play.
We both have configured ostel.co accounts, using tls and zrtp. 

Original comment by hvtaifwk...@gmail.com on 18 Jan 2015 at 9:28

GoogleCodeExporter commented 9 years ago
Hi,

The version on the playstore is outdate.
Please download and install the 1.5 from 
http://nightlies.csipsimple.com/plugins/

I'm trying to solve some change in android 5.x changes before releasing on 
playstore.

Original comment by r3gis...@gmail.com on 8 Feb 2015 at 5:09

GoogleCodeExporter commented 9 years ago
I'm experiencing another kind of choppy sound with Opus: with a ptime of 40ms 
in FreeSwitch (Opus frame composed of 2*20ms subframes), the decoded audio by 
CSS is missing the second part (20ms of sound followed by 20ms of silence) and 
so on...

SDP:
v=0
o=FreeSWITCH 1424805772 1424805773 IN IP4 192.168.1.3
s=FreeSWITCH
c=IN IP4 192.168.1.3
t=0 0
m=audio 10454 RTP/AVP 111 101
a=rtpmap:111 opus/48000/2
a=fmtp:111 maxplaybackrate=16000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:40
a=rtcp:10455 IN IP4 192.168.1.3

Partial log:
23:25:17.778      pj_opus.c !Frame recovered 640
23:25:17.778      pj_opus.c  Frame recovered 320
23:25:17.779 pjsua_jni_addo !.....Call 0 state changed to CONFIRMED
23:25:17.779      pj_opus.c !Encoder packet size 65 for input 1280 ouput max 
len 800 @ 6720
23:25:17.781      pj_opus.c  Frame recovered 640
23:25:17.781      pj_opus.c  Frame recovered 320
23:25:17.781 pjsua_jni_addo !.....Get secure for media type 1
23:25:17.782      pj_opus.c !Encoder packet size 84 for input 1280 ouput max 
len 800 @ 7360
23:25:17.782   Master/sound  Underflow, buf_cnt=0, will generate 1 frame
23:25:17.782      pj_opus.c  Frame recovered 640
23:25:17.782      pj_opus.c  Frame recovered 320
23:25:17.782   Master/sound  Underflow, buf_cnt=0, will generate 1 frame
23:25:17.783      pj_opus.c  Encoder packet size 75 for input 1280 ouput max 
len 800 @ 8000
23:25:17.783      pj_opus.c  Frame recovered 640
23:25:17.783      pj_opus.c  Frame recovered 320
23:25:17.785   Master/sound  Underflow, buf_cnt=0, will generate 1 frame
23:25:17.786      pj_opus.c  Encoder packet size 76 for input 1280 ouput max 
len 800 @ 8640
23:25:17.786 zrtp_android.c !ZRTP info message: Hello received, preparing a 
Commit
23:25:17.789 zrtp_android.c  ZRTP info message: Commit: Generated a public DH 
key
23:25:17.791 pjsua_jni_addo !.....Get secure for media type 1
23:25:17.885      pj_opus.c !Frame recovered 640
23:25:17.885      pj_opus.c  Frame recovered 320
23:25:17.886      pj_opus.c  Encoder packet size 66 for input 1280 ouput max 
len 800 @ 9280
23:25:17.886      pj_opus.c  Frame recovered 640
23:25:17.886      pj_opus.c  Frame recovered 320
23:25:17.887      pj_opus.c  Encoder packet size 53 for input 1280 ouput max 
len 800 @ 9920
23:25:17.887   Master/sound  Underflow, buf_cnt=0, will generate 1 frame
23:25:17.905      pj_opus.c  Encoder packet size 62 for input 1280 ouput max 
len 800 @ 10560
23:25:18.006      pj_opus.c  Encoder packet size 70 for input 1280 ouput max 
len 800 @ 11200
23:25:18.006      pj_opus.c  Encoder packet size 58 for input 1280 ouput max 
len 800 @ 11840
23:25:18.025      pj_opus.c  Encoder packet size 66 for input 1280 ouput max 
len 800 @ 12480
23:25:18.125      pj_opus.c  Encoder packet size 59 for input 1280 ouput max 
len 800 @ 13120
23:25:18.127      pj_opus.c  Encoder packet size 71 for input 1280 ouput max 
len 800 @ 13760
23:25:18.145      pj_opus.c  Encoder packet size 56 for input 1280 ouput max 
len 800 @ 14400
23:25:18.246      pj_opus.c  Encoder packet size 62 for input 1280 ouput max 
len 800 @ 15040
23:25:18.248      pj_opus.c  Encoder packet size 62 for input 1280 ouput max 
len 800 @ 15680
23:25:18.266      pj_opus.c  Encoder packet size 51 for input 1280 ouput max 
len 800 @ 16320
23:25:18.366      pj_opus.c  Encoder packet size 59 for input 1280 ouput max 
len 800 @ 16960
23:25:18.368      pj_opus.c  Encoder packet size 54 for input 1280 ouput max 
len 800 @ 17600
23:25:18.386      pj_opus.c  Encoder packet size 53 for input 1280 ouput max 
len 800 @ 18240
23:25:18.487      pj_opus.c  Encoder packet size 51 for input 1280 ouput max 
len 800 @ 18880
23:25:18.490      pj_opus.c  Encoder packet size 66 for input 1280 ouput max 
len 800 @ 19520
23:25:18.506      pj_opus.c  Encoder packet size 61 for input 1280 ouput max 
len 800 @ 20160
23:25:18.590 zrtp_android.c !ZRTP info message: Initiator: DHPart1 received, 
preparing DHPart2
23:25:18.597 zrtp_android.c  ZRTP info message: At least one retained secrets 
matches - security OK
23:25:18.606      pj_opus.c !Encoder packet size 71 for input 1280 ouput max 
len 800 @ 20800
23:25:18.608      pj_opus.c  Encoder packet size 68 for input 1280 ouput max 
len 800 @ 21440
23:25:18.627      pj_opus.c  Encoder packet size 66 for input 1280 ouput max 
len 800 @ 22080
23:25:18.727      pj_opus.c  Encoder packet size 62 for input 1280 ouput max 
len 800 @ 22720
23:25:18.729      pj_opus.c  Encoder packet size 59 for input 1280 ouput max 
len 800 @ 23360
23:25:18.730 zrtp_android.c !ZRTP info message: Initiator: Confirm1 received, 
preparing Confirm2
23:25:18.747      pj_opus.c !Encoder packet size 65 for input 1280 ouput max 
len 800 @ 24000
23:25:18.849      pj_opus.c  Encoder packet size 61 for input 1280 ouput max 
len 800 @ 24640
23:25:18.853      pj_opus.c  Encoder packet size 57 for input 1280 ouput max 
len 800 @ 25280
23:25:18.861 zrtp_android.c !Show sas : indw in ctxt 2a287cd0
23:25:18.865 zrtp_android.c  ZRTP info message: Entered secure state
23:25:18.867 pjsua_jni_addo !Get secure for media type 1
23:25:18.867      pj_opus.c !Pkt info : bw -> 1105 , spf -> 320, offset 2, 
packet_size 289
23:25:18.868      pj_opus.c  parsed 289 of 2
23:25:18.868      pj_opus.c  parsed 289 of 2
23:25:18.873 pjsua_jni_addo !Get secure for media type 1
23:25:18.892      pj_opus.c !Pkt info : bw -> 1105 , spf -> 320, offset 2, 
packet_size 248
23:25:18.893      pj_opus.c  parsed 248 of 2
23:25:18.893      pj_opus.c  parsed 248 of 2
23:25:18.931      pj_opus.c !Pkt info : bw -> 1105 , spf -> 320, offset 2, 
packet_size 266
23:25:18.931      pj_opus.c  parsed 266 of 2
23:25:18.931      pj_opus.c  parsed 266 of 2
23:25:18.966      pj_opus.c !Encoder packet size 74 for input 1280 ouput max 
len 800 @ 25920
23:25:18.967      pj_opus.c  Decode : copy from big buffer 1280 to 640
23:25:18.967      pj_opus.c  Decoded 289 to 640 with max 1280
23:25:18.967      pj_opus.c  Decode : copy from big buffer 640 to 640
23:25:18.967      pj_opus.c  Decoded 289 to 640 with max 640
23:25:18.969      pj_opus.c  Encoder packet size 63 for input 1280 ouput max 
len 800 @ 26560
23:25:18.970      pj_opus.c  Decode : copy from big buffer 1280 to 640
23:25:18.970      pj_opus.c  Decoded 248 to 640 with max 1280
23:25:18.970      pj_opus.c  Decode : copy from big buffer 640 to 640
23:25:18.970      pj_opus.c  Decoded 248 to 640 with max 640
23:25:18.972      pj_opus.c  Encoder packet size 58 for input 1280 ouput max 
len 800 @ 27200
23:25:18.974      pj_opus.c !Pkt info : bw -> 1105 , spf -> 320, offset 2, 
packet_size 323
23:25:18.974      pj_opus.c  parsed 323 of 2
23:25:18.974      pj_opus.c  parsed 323 of 2
23:25:18.985      pj_opus.c !Decode : copy from big buffer 1280 to 640
23:25:18.985      pj_opus.c  Decoded 266 to 640 with max 1280
23:25:18.985      pj_opus.c  Decode : copy from big buffer 640 to 640
23:25:18.985      pj_opus.c  Decoded 266 to 640 with max 640

I've been taking a look at opus_codec_parse() (pj_opus.c) and if I set 
*frame_cnt = 1; before the loop, the issue improves with continuous clicks.

By the way, in opus_codec_decode(),
the mask for frm_info should'n be 0xff, as shown in opus_codec_parse()?
  frm_info = input->bit_info & 0xFF;
instead of
  frm_info = input->bit_info & 0xF;
Opus accepts up to 48 subframes for an internal ptime of 2.5ms.

Original comment by aeburr...@gmail.com on 24 Feb 2015 at 10:42

GoogleCodeExporter commented 9 years ago
can't reproduce with current versions, except that now I have Motorola Moto G 
2014.  

Original comment by hvtaifwk...@gmail.com on 14 Apr 2015 at 7:13