[go: up one dir, main page]

Menu

[r46]: / TODO.txt  Maximize  Restore  History

Download this file

815 lines (702 with data), 39.6 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
todo:
- settings vvv-server?
- ?explain: "the address is not available" means changed local ip)
- audio flickering issue;
- wakelock on STUN autorefresh? mmmm never mind
?- check port conflicts range
- document tmr:100 for android audio input; swggest to keep wi-fi on during sleep in android
- document "self-connection" 1) to test audio 2) if host = localhost and UDP range>0 will self-connect (it's NOT a bug!)
- [fileservity bug! -> ALLOW_LARGE_FILE flag in stdio]
done 1.4:
- Public list:
As an extra option, upon 'Receiver' activation it's possible to share network data
(including an arbitrary 'Nickname') on a temporary 'Public list'
peers can select from to place calls without having to exchange IP and port numbers.
Data are deleted by toggling the option off or closing the 'Receiver',
however after 60 seconds since the last keep-alive packet ('TP' interval configurable),
will automatically expire.
- UDP punching call back:
Relying on the 'Public list', the 'Receiver' can also get 'UDP connection' incoming calls.
- STUN XOR-MAPPED-ADDRESS
addedd XOR-MAPPED-ADDRESS implementation to extend the choice also to servers that does not
support clear MAPPED-ADDRESS
- STUN ping rate:
adjustable STUN autorefresh timer interval (was 'STUN keep-alive', with fixed timer)
- Audio threshold:
- input: set the minimum level at which send data (save bandwidth when not speaking
and reduce lag)
- output: set the maximum level at which not truncate audio (save your eardrums especially
if strange packets come in)
- Android Proximity Sensor (where supported):
During a phone call, automatically turn off the touchscreen when the handset
is being held close to a user's face, as in usual telephony calls.
- log rotation file log:
up to 3 16KB backup file logs are stored in the application (data) directory
and transparently loaded as you switch to 'Log' view.
- UI improvements & BUG fixing:
- extended connection chances through the use of both public and local
endpoint probeing, either by TCP and UDP (when using 'Public list');
this probed useful with mobile networks in particular
- check audio packet source:
discard audio packed if source addr/port are different from expected
(occasionally, on mobile networks, the audio connection may receive strange data
that if delivered to the audio device caused an annoyng noice)
- UDP punching timeout:
autodisconnect if not receiving keep-alive request for 10 seconds
on the communication channel
- keep android wakelock if STUN still active
- log panel notification icon
- copy local address button
- Slider Popup window to facilitate Dial adjustments (volume, thresholds)
on small system (i.e. smartphones)
- save net and audio settings after good connection/activation
- columns autoresize in tables around
- wait animation while querying stunlist on settingsdialog
- added missing disabled border style (qt5 android)
- purged STUN list from faulty hosts
- for better linux portability linked statically to libstdc++
- fixed unrecoverable query state on invalid STUN header
- fixed STUN client not rejecting data from wrong host (sticky peer still sending data)
- fixed comunication error "read error:unknown data type" on audio negotiation
- fixed misleading buffer log on comunication 'read error'
- etc etc etc...
done 1.3:
- New "walkie-talkie" mode ("<BROADCAST>")
NOTABENE:
- set UDP-punching on and leave the remote address empty for "connection"
- only works in Local Area Networks
- no audio negotiation is carried out
- enhanced three-state P2T (push-to-talk):
if state = "partially-checked" (red check-mark) mute audio-output when talking
(reduce echoes, only implemented if QT>=5, i.e. just on Android for now)
- P2T activation beep
- send "trill" function ("Chat" panel)
- enanched UDP punching:
with a small porting scanning range can eventually punch even
a mobile network misbehaving router!
- fixed some audio issues (wake up idle audio-input upon push-to-talk,
auto restart audio-output when stopped on error)
- various UI improvements/corrections (better connection management through "Line" panel,
moved "Log" view to a new specific panel,
added easy reachable large P2T button in "Audio" panel,
new refresh button for service local ip,
new copy button for service local address data,
new clear-log and clear-chat buttons,
save both UDP ports in history if UDP hole punching on,
handle android back button with moveTaskToBack,
async DNS queries, STUN keep-alive, punch port range, etc etc)
//caratteri più grandi history
//temporizzare attacca stacca audio per ridurre lag
//wakelock
================================================================================
NEXT
================================================================================
doc: FAQ, settings
rebuikd; mac (on [receiver])
? log tab icon on err/warning/notice
? android: p2t handle ACTION_MEDIA_BUTTON -> http://developer.android.com/training/managing-audio/volume-playback.html
? android: vibrate?
? Optional public listing: "List me" check box + nickname field in net svr section
(change receiver behaviour when udp punch to only update public user data);
list button accanto client public ip?
? autoreconnect
? file-transfer history (in history panel)
? opus PLC/FEC to avoid audio output idle
? audio threshold
? save log
? udp local port field
? contacts panel accessible from netpanel/peer
? switch-board role
? android wake lock prevent screensaver http://irrlicht.sourceforge.net/forum/viewtopic.php?f=9&t=50228
================================================================================
MEMO
================================================================================
- qt5-multimedia must be installed (on arch: pacman -S qt5-multimedia)
- to debug on linux output must be in linux partition?
- tar -zcvf viavoip-linux-1.X.tar.gz ViaVoip
- pulseaudio -D|kill
- alsactl init
- typedef iterator erc etc commentato in /home/BIN/qt4.7.0/include/QtCore/qtconcurrentfilter.h(109)
- if someday porting win from 4.7 to 4.8, rebuild qt 4.8 with msvc2010 service pack 1.
- android:
* NB
- before rebuild, if modified/added assets put them in the src/android/assets dir!
- why "export ANDROID_TMP=/home/tilly/tmp"? (error: could not write file /tmp/android-tilly/emulator-JxdZD8) = non more room! ;)
usual commands list:
>terminal-1:
cd ~/BIN/android/android-sdk-linux
export ANDROID_TMP=/home/tilly/tmp
./tools/emulator -force-32bit @ARM_FWVGA_QT
>terminal-2 (change version appropriately in filename!):
cp /home/tilly/qvoip_build/ViaVoip/android-19-arm7-release/android-build/bin/QtApp-release-signed.apk /home/tilly/qvoip_build/ViaVoip/ViaVoip-442arm7-1.3.apk
./platform-tools/adb uninstall com.utillyty.viavoip
./platform-tools/adb install /home/tilly/qvoip_build/ViaVoip/ViaVoip-442arm7-1.2.apk
* xtra usefull commands:
+ it's also possible to uninstall from simulator (settings/apps), but much much slower!
+ ./platform-tools/adb logcat
+ ./platform-tools/adb forward tcp:1024 tcp:1024 (NB: only TCP) to start avd viavoip instance as receiver NB: ip=127.0.0.1;to delete: adb forward tcp:1024
+ telnet 127.0.0.1 5554 > redir add udp:xxxx:yyyy
+ ./platform-tools/adb shell > netcfg | ifconfig eth0
DEBUG USB
activate debug:
https://www.androidpit.it/come-attivare-debug-usb:
Se riuscite a trovare la voce Opzioni sviluppatore all'interno del menu di impostazioni:
Aprite Opzioni sviluppatore ed attivatele.
Attivate l’opzione Debug USB.
Se invece non riuscite a trovarle, vi bastano pochi passi per farle comparire:
Aprite il menu delle impostazioni.
Selezionate Info sul dispositivo.
Premete 7 volte su Versione build.
Tornate alle impostazioni.
Cliccate su Opzioni sviluppatore non appena compariranno tra le varie voci del menu ed attivatele.
Attivate ora l’opzione Debug USB.
NB funziona solo in quello nuovo di anto
[old:
* /AUR/genymotion/pkg/genymotion/opt/genymotion/genymotion
* (genymotion) modprobe vboxdrv + vboxnetadp + vboxnetflt
* http://download.qt.io/archive/qt/5.4/5.4.1/
???* build opus for android:
???- export NDK=/home/tilly/BIN/android/android-ndk-r10d
]
- mac osx:
- install xcode before installing qt!!!
- run /usr/bin/xcodebuild before installing qt!!!
- install qt
- build opus (./configure; make; sudo make install)
- remove *opus*.dylib and *opus*.la from /usr/local/lib (or clang will give precedence)
- build ViaVoip!
* /usr/bin/qt4-static/bin/qmake -o Makefile ViaVoip.pro
* make
* copy assets (*.wav) to Contents/MacOS
* change info.plist (version info, etc)
* delete Viavoip.data after test!
- SVN:
wrong marked bin files: svn propdel svn:mime-type [mislabeled-text-file...]
================================================================================
DEPS
================================================================================
ldd ViaVoip (qt4-release):
linux-gate.so.1 (0xb7748000)
libQtMultimedia.so.4 => /usr/lib/libQtMultimedia.so.4 (0xb76ee000)
libQtSql.so.4 => /usr/lib/libQtSql.so.4 (0xb76ae000)
libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0xb6ba1000)
libQtNetwork.so.4 => /usr/lib/libQtNetwork.so.4 (0xb6a52000)
libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0xb674e000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6658000)
libm.so.6 => /usr/lib/libm.so.6 (0xb660b000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xb65ee000)
libc.so.6 => /usr/lib/libc.so.6 (0xb6434000)
libasound.so.2 => /usr/lib/libasound.so.2 (0xb6328000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0xb630a000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb61e3000)
libpng16.so.16 => /usr/lib/libpng16.so.16 (0xb61a4000)
libz.so.1 => /usr/lib/libz.so.1 (0xb618d000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb60ca000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb606c000)
libSM.so.6 => /usr/lib/libSM.so.6 (0xb6063000)
libICE.so.6 => /usr/lib/libICE.so.6 (0xb6046000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb603b000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb5ffe000)
libXext.so.6 => /usr/lib/libXext.so.6 (0xb5fe8000)
libX11.so.6 => /usr/lib/libX11.so.6 (0xb5e98000)
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0xb5e1e000)
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0xb5c0b000)
libdl.so.2 => /usr/lib/libdl.so.2 (0xb5c06000)
librt.so.1 => /usr/lib/librt.so.1 (0xb5bfc000)
/lib/ld-linux.so.2 (0xb7749000)
libpcre.so.1 => /usr/lib/libpcre.so.1 (0xb5b88000)
libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0xb5b77000)
libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0xb5b18000)
libffi.so.6 => /usr/lib/libffi.so.6 (0xb5b0f000)
libuuid.so.1 => /usr/lib/libuuid.so.1 (0xb5b08000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb5adf000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb5ab9000)
libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0xb5a9b000)
libXau.so.6 => /usr/lib/libXau.so.6 (0xb5a97000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb5a8f000)
================================================================================
QT FORUM
================================================================================
Hello,
I'm writing a [simple VoIP application](http://sourceforge.net/projects/viavoip/), and by now it runs very well on **Windows**, while on **Linux** (I'm using *3.18.6-1-ARCH, gcc 4.9.2*) I have no choice but build it against **Qt5**, start the **PulseAudio** daemon, and select the devices shown in this [picture](http://a.fsdn.com/con/app/proj/viavoip/screenshots/screenshot-03.png), otherwise as soon as I do some UI interaction it soon crashes.
If I use **QAudioOutput** in "push mode", I get **SIGSEGV** when I write to the **QIODevice** returned by QAudioOutput::start(), at this line:
m_pushoutput->write(m_pushbuff.constData(), len);
in the [audiooutpanel.cpp](http://sourceforge.net/p/viavoip/src/HEAD/tree/audiooutpanel.cpp) file (line 312);
if I use QAudioOutput in "pull mode", after a while the application will indefinitely hung.
I further investigated, compiled a debug version of **Qt 4.8.6**, and found that, when the system sends **SIGSGV**, the debugger stops at this line:
int space = bytesFree();
in the **QAudioOutputPrivate::write** function of the **qaudiooutput_alsa_p.cpp** file of the qt 4.8.6 source (11 lines below):
qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
{
// Write out some audio data
if ( !handle )
return 0;
#ifdef DEBUG_AUDIO
qDebug()<<"frames to write out = "<<
snd_pcm_bytes_to_frames( handle, (int)len )<<" ("<<len<<") bytes";
#endif
int frames, err;
int space = bytesFree();
if(len < space) {
// Just write it
frames = snd_pcm_bytes_to_frames( handle, (int)len );
err = snd_pcm_writei( handle, data, frames );
} else {
// Only write space worth
frames = snd_pcm_bytes_to_frames( handle, (int)space );
err = snd_pcm_writei( handle, data, frames );
}
if(err > 0) {
totalTimeValue += err;
resuming = false;
errorState = QAudio::NoError;
if (deviceState != QAudio::ActiveState) {
deviceState = QAudio::ActiveState;
emit stateChanged(deviceState);
}
return snd_pcm_frames_to_bytes( handle, err );
} else
err = xrun_recovery(err);
if(err < 0) {
close();
errorState = QAudio::FatalError;
deviceState = QAudio::StoppedState;
emit stateChanged(deviceState);
}
return 0;
}
Thanks for any help.
PS: also I don't seem to find a way to succesfully build qt 4.8.6 with full PulseAudio support as **QAudioDeviceInfo::availableDevices** only returns two items ("system default" and "default"); this is the last configuration I've tryed:
./configure -platform linux-g++ -static -debug -prefix /home/tilly/BIN/qt-4.8.6-debug -qt-sql-sqlite -multimedia -audio-backend -system-nas-sound -no-openssl -no-qt3support -no-xmlpatterns -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -no-declarative-debug -no-nis -no-cups -nomake demos -nomake examples -nomake tools
-----------
Hi, thank you for your quick and kind reply :)
I've run configure with the -v option, this is the output as for PulseAudio:
PulseAudio auto-detection... ()
g++ -c -pipe -D_REENTRANT -g -Wall -W -I../../../mkspecs/linux-g++ -I. -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -o pulseaudio.o pulseaudio.cpp
g++ -Wl,-rpath,/home/tilly/BIN/qt-4.8.6-debug/lib -o pulseaudio pulseaudio.o -lpulse-mainloop-glib -lpulse -lglib-2.0
PulseAudio enabled.
So it seems it's been detected.
I'm not aware of any PulseAudio development package on ARCH linux, anyway I checked that the folder /usr/include/pulse is present in my system, and contains the pulseaudio header files, but I don't know if this is sufficient. Should I download something else?
As for the crashes, yes I run the app with the debug build (of Qt, right?) and, as I wrote, while with the release build I got stuck in the
m_pushoutput->write(m_pushbuff.constData(), len);
line of my code (where m_pushoutput is the QIODevice returned by calling QAudioOutput::start()), with the debug build the SIGSEGV is emitted at this line:
int space = bytesFree();
in the qaudiooutput_alsa_p.cpp file of the qt 4.8.6 sources.
To be more precise crashes happens randomly, for example, right after I click on a combo (before changing selection), when both audioinput and adiooutput are processing audio. The same thing (even worst) happens with Qt5, but in that case, when I select the "alsa_input" and "alsa_output" devices as shown [here](http://a.fsdn.com/con/app/proj/viavoip/screenshots/screenshot-03.png), it runs smoothly.
As it stops before entering the bytesAvailable() function, it looks like a stack overflow or something, but I don't know how to further investigate.
-----------
Dear SGainst, I did run a debug build of Qt (v4.8.6) and my software, and found that where the program crashes each time is at this instruction at line 525 of the qtaudiooutput_pulse_p.cpp Qt 4.8.6 source file:
int space = bytesFree();
that is found inside this function:
qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
{
// Write out some audio data
if ( !handle )
return 0;
#ifdef DEBUG_AUDIO
qDebug()<<"frames to write out = "<<
snd_pcm_bytes_to_frames( handle, (int)len )<<" ("<<len<<") bytes";
#endif
int frames, err;
int space = bytesFree();
if(len < space) {
// Just write it
frames = snd_pcm_bytes_to_frames( handle, (int)len );
err = snd_pcm_writei( handle, data, frames );
} else {
// Only write space worth
frames = snd_pcm_bytes_to_frames( handle, (int)space );
err = snd_pcm_writei( handle, data, frames );
}
if(err > 0) {
totalTimeValue += err;
resuming = false;
errorState = QAudio::NoError;
if (deviceState != QAudio::ActiveState) {
deviceState = QAudio::ActiveState;
emit stateChanged(deviceState);
}
return snd_pcm_frames_to_bytes( handle, err );
} else
err = xrun_recovery(err);
if(err < 0) {
close();
errorState = QAudio::FatalError;
deviceState = QAudio::StoppedState;
emit stateChanged(deviceState);
}
return 0;
}
As there are no variables deferencing at that point, I thought it can probably be a stack overflow(?), but I don't actually know how to interpret/fix this. Here's the Disassembler view at eip:
516 [1] {
0x80be742 55 push %ebp
0x80be743 <+0x0001> 89 e5 mov %esp,%ebp
0x80be745 <+0x0003> 57 push %edi
0x80be746 <+0x0004> 56 push %esi
0x80be747 <+0x0005> 53 push %ebx
0x80be748 <+0x0006> 83 ec 2c sub $0x2c,%esp
0x80be74b <+0x0009> e8 a0 45 f9 ff call 0x8052cf0 <__x86.get_pc_thunk.bx>
0x80be750 <+0x000e> 81 c3 ac 57 e2 00 add $0xe257ac,%ebx
0x80be756 <+0x0014> 8b 45 10 mov 0x10(%ebp),%eax
0x80be759 <+0x0017> 89 45 d0 mov %eax,-0x30(%ebp)
0x80be75c <+0x001a> 8b 45 14 mov 0x14(%ebp),%eax
0x80be75f <+0x001d> 89 45 d4 mov %eax,-0x2c(%ebp)
518 [1] if ( !handle )
0x80be762 <+0x0020> 8b 45 08 mov 0x8(%ebp),%eax
0x80be765 <+0x0023> 8b 40 78 mov 0x78(%eax),%eax
0x80be768 <+0x0026> 85 c0 test %eax,%eax
0x80be76a <+0x0028> 75 0f jne 0x80be77b <QAudioOutputPrivate::write(char const*, long long)+57>
519 [1] return 0;
0x80be76c <+0x002a> b8 00 00 00 00 mov $0x0,%eax
0x80be771 <+0x002f> ba 00 00 00 00 mov $0x0,%edx
0x80be776 <+0x0034> e9 65 01 00 00 jmp 0x80be8e0 <QAudioOutputPrivate::write(char const*, long long)+414>
525 [1] int space = bytesFree();
0x80be77b <+0x0039> 8b 45 08 mov 0x8(%ebp),%eax
0x80be77e <+0x003c> 8b 00 mov (%eax),%eax
0x80be780 <+0x003e> 83 c0 44 add $0x44,%eax
0x80be783 <+0x0041> 8b 00 mov (%eax),%eax
0x80be785 <+0x0043> 83 ec 0c sub $0xc,%esp
0x80be788 <+0x0046> ff 75 08 pushl 0x8(%ebp)
0x80be78b <+0x0049> ff d0 call *%eax
0x80be78d <+0x004b> 83 c4 10 add $0x10,%esp
0x80be790 <+0x004e> 89 45 e0 mov %eax,-0x20(%ebp)
526 [1] if(len < space) {
0x80be793 <+0x0051> 8b 45 e0 mov -0x20(%ebp),%eax
0x80be796 <+0x0054> 99 cltd
0x80be797 <+0x0055> 3b 55 d4 cmp -0x2c(%ebp),%edx
0x80be79a <+0x0058> 7c 41 jl 0x80be7dd <QAudioOutputPrivate::write(char const*, long long)+155>
0x80be79c <+0x005a> 3b 55 d4 cmp -0x2c(%ebp),%edx
0x80be79f <+0x005d> 7f 05 jg 0x80be7a6 <QAudioOutputPrivate::write(char const*, long long)+100>
0x80be7a1 <+0x005f> 3b 45 d0 cmp -0x30(%ebp),%eax
0x80be7a4 <+0x0062> 76 37 jbe 0x80be7dd <QAudioOutputPrivate::write(char const*, long long)+155>
528 [1] frames = snd_pcm_bytes_to_frames( handle, (int)len );
0x80be7a6 <+0x0064> 8b 55 d0 mov -0x30(%ebp),%edx
0x80be7a9 <+0x0067> 8b 45 08 mov 0x8(%ebp),%eax
0x80be7ac <+0x006a> 8b 40 78 mov 0x78(%eax),%eax
0x80be7af <+0x006d> 83 ec 08 sub $0x8,%esp
0x80be7b2 <+0x0070> 52 push %edx
0x80be7b3 <+0x0071> 50 push %eax
0x80be7b4 <+0x0072> e8 e7 22 f9 ff call 0x8050aa0 <snd_pcm_bytes_to_frames@plt>
0x80be7b9 <+0x0077> 83 c4 10 add $0x10,%esp
0x80be7bc <+0x007a> 89 45 dc mov %eax,-0x24(%ebp)
529 [1] err = snd_pcm_writei( handle, data, frames );
0x80be7bf <+0x007d> 8b 55 dc mov -0x24(%ebp),%edx
0x80be7c2 <+0x0080> 8b 45 08 mov 0x8(%ebp),%eax
0x80be7c5 <+0x0083> 8b 40 78 mov 0x78(%eax),%eax
0x80be7c8 <+0x0086> 83 ec 04 sub $0x4,%esp
0x80be7cb <+0x0089> 52 push %edx
0x80be7cc <+0x008a> ff 75 0c pushl 0xc(%ebp)
0x80be7cf <+0x008d> 50 push %eax
0x80be7d0 <+0x008e> e8 1b 18 f9 ff call 0x804fff0 <snd_pcm_writei@plt>
0x80be7d5 <+0x0093> 83 c4 10 add $0x10,%esp
0x80be7d8 <+0x0096> 89 45 e4 mov %eax,-0x1c(%ebp)
0x80be7db <+0x0099> eb 34 jmp 0x80be811 <QAudioOutputPrivate::write(char const*, long long)+207>
532 [1] frames = snd_pcm_bytes_to_frames( handle, (int)space );
0x80be7dd <+0x009b> 8b 45 08 mov 0x8(%ebp),%eax
0x80be7e0 <+0x009e> 8b 40 78 mov 0x78(%eax),%eax
0x80be7e3 <+0x00a1> 83 ec 08 sub $0x8,%esp
0x80be7e6 <+0x00a4> ff 75 e0 pushl -0x20(%ebp)
0x80be7e9 <+0x00a7> 50 push %eax
0x80be7ea <+0x00a8> e8 b1 22 f9 ff call 0x8050aa0 <snd_pcm_bytes_to_frames@plt>
0x80be7ef <+0x00ad> 83 c4 10 add $0x10,%esp
0x80be7f2 <+0x00b0> 89 45 dc mov %eax,-0x24(%ebp)
533 [1] err = snd_pcm_writei( handle, data, frames );
0x80be7f5 <+0x00b3> 8b 55 dc mov -0x24(%ebp),%edx
0x80be7f8 <+0x00b6> 8b 45 08 mov 0x8(%ebp),%eax
0x80be7fb <+0x00b9> 8b 40 78 mov 0x78(%eax),%eax
0x80be7fe <+0x00bc> 83 ec 04 sub $0x4,%esp
0x80be801 <+0x00bf> 52 push %edx
0x80be802 <+0x00c0> ff 75 0c pushl 0xc(%ebp)
0x80be805 <+0x00c3> 50 push %eax
0x80be806 <+0x00c4> e8 e5 17 f9 ff call 0x804fff0 <snd_pcm_writei@plt>
0x80be80b <+0x00c9> 83 c4 10 add $0x10,%esp
0x80be80e <+0x00cc> 89 45 e4 mov %eax,-0x1c(%ebp)
535 [1] if(err > 0) {
0x80be811 <+0x00cf> 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
0x80be815 <+0x00d3> 7e 6d jle 0x80be884 <QAudioOutputPrivate::write(char const*, long long)+322>
536 [1] totalTimeValue += err;
0x80be817 <+0x00d5> 8b 45 08 mov 0x8(%ebp),%eax
0x80be81a <+0x00d8> 8b 70 28 mov 0x28(%eax),%esi
0x80be81d <+0x00db> 8b 78 2c mov 0x2c(%eax),%edi
0x80be820 <+0x00de> 8b 45 e4 mov -0x1c(%ebp),%eax
0x80be823 <+0x00e1> 99 cltd
0x80be824 <+0x00e2> 01 f0 add %esi,%eax
0x80be826 <+0x00e4> 11 fa adc %edi,%edx
0x80be828 <+0x00e6> 8b 4d 08 mov 0x8(%ebp),%ecx
0x80be82b <+0x00e9> 89 41 28 mov %eax,0x28(%ecx)
0x80be82e <+0x00ec> 89 51 2c mov %edx,0x2c(%ecx)
537 [1] resuming = false;
0x80be831 <+0x00ef> 8b 45 08 mov 0x8(%ebp),%eax
0x80be834 <+0x00f2> c6 40 1a 00 movb $0x0,0x1a(%eax)
538 [1] errorState = QAudio::NoError;
0x80be838 <+0x00f6> 8b 45 08 mov 0x8(%ebp),%eax
0x80be83b <+0x00f9> c7 40 10 00 00 00 00 movl $0x0,0x10(%eax)
539 [1] if (deviceState != QAudio::ActiveState) {
0x80be842 <+0x0100> 8b 45 08 mov 0x8(%ebp),%eax
0x80be845 <+0x0103> 8b 40 14 mov 0x14(%eax),%eax
0x80be848 <+0x0106> 85 c0 test %eax,%eax
0x80be84a <+0x0108> 74 20 je 0x80be86c <QAudioOutputPrivate::write(char const*, long long)+298>
540 [1] deviceState = QAudio::ActiveState;
0x80be84c <+0x010a> 8b 45 08 mov 0x8(%ebp),%eax
0x80be84f <+0x010d> c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
541 [1] emit stateChanged(deviceState);
0x80be856 <+0x0114> 8b 45 08 mov 0x8(%ebp),%eax
0x80be859 <+0x0117> 8b 50 14 mov 0x14(%eax),%edx
0x80be85c <+0x011a> 8b 45 08 mov 0x8(%ebp),%eax
0x80be85f <+0x011d> 83 ec 08 sub $0x8,%esp
0x80be862 <+0x0120> 52 push %edx
0x80be863 <+0x0121> 50 push %eax
0x80be864 <+0x0122> e8 a1 35 00 00 call 0x80c1e0a <QAbstractAudioOutput::stateChanged(QAudio::State)>
0x80be869 <+0x0127> 83 c4 10 add $0x10,%esp
543 [1] return snd_pcm_frames_to_bytes( handle, err );
0x80be86c <+0x012a> 8b 45 08 mov 0x8(%ebp),%eax
0x80be86f <+0x012d> 8b 40 78 mov 0x78(%eax),%eax
0x80be872 <+0x0130> 83 ec 08 sub $0x8,%esp
0x80be875 <+0x0133> ff 75 e4 pushl -0x1c(%ebp)
0x80be878 <+0x0136> 50 push %eax
0x80be879 <+0x0137> e8 42 43 f9 ff call 0x8052bc0 <snd_pcm_frames_to_bytes@plt>
0x80be87e <+0x013c> 83 c4 10 add $0x10,%esp
0x80be881 <+0x013f> 99 cltd
0x80be882 <+0x0140> eb 5c jmp 0x80be8e0 <QAudioOutputPrivate::write(char const*, long long)+414>
545 [1] err = xrun_recovery(err);
0x80be884 <+0x0142> 83 ec 08 sub $0x8,%esp
0x80be887 <+0x0145> ff 75 e4 pushl -0x1c(%ebp)
0x80be88a <+0x0148> ff 75 08 pushl 0x8(%ebp)
0x80be88d <+0x014b> e8 b4 e3 ff ff call 0x80bcc46 <QAudioOutputPrivate::xrun_recovery(int)>
0x80be892 <+0x0150> 83 c4 10 add $0x10,%esp
0x80be895 <+0x0153> 89 45 e4 mov %eax,-0x1c(%ebp)
547 [1] if(err < 0) {
0x80be898 <+0x0156> 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
0x80be89c <+0x015a> 79 38 jns 0x80be8d6 <QAudioOutputPrivate::write(char const*, long long)+404>
548 [1] close();
0x80be89e <+0x015c> 83 ec 0c sub $0xc,%esp
0x80be8a1 <+0x015f> ff 75 08 pushl 0x8(%ebp)
0x80be8a4 <+0x0162> e8 3f fd ff ff call 0x80be5e8 <QAudioOutputPrivate::close()>
0x80be8a9 <+0x0167> 83 c4 10 add $0x10,%esp
549 [1] errorState = QAudio::FatalError;
0x80be8ac <+0x016a> 8b 45 08 mov 0x8(%ebp),%eax
0x80be8af <+0x016d> c7 40 10 04 00 00 00 movl $0x4,0x10(%eax)
550 [1] deviceState = QAudio::StoppedState;
0x80be8b6 <+0x0174> 8b 45 08 mov 0x8(%ebp),%eax
0x80be8b9 <+0x0177> c7 40 14 02 00 00 00 movl $0x2,0x14(%eax)
551 [1] emit stateChanged(deviceState);
0x80be8c0 <+0x017e> 8b 45 08 mov 0x8(%ebp),%eax
0x80be8c3 <+0x0181> 8b 50 14 mov 0x14(%eax),%edx
0x80be8c6 <+0x0184> 8b 45 08 mov 0x8(%ebp),%eax
0x80be8c9 <+0x0187> 83 ec 08 sub $0x8,%esp
0x80be8cc <+0x018a> 52 push %edx
0x80be8cd <+0x018b> 50 push %eax
0x80be8ce <+0x018c> e8 37 35 00 00 call 0x80c1e0a <QAbstractAudioOutput::stateChanged(QAudio::State)>
0x80be8d3 <+0x0191> 83 c4 10 add $0x10,%esp
553 [1] return 0;
0x80be8d6 <+0x0194> b8 00 00 00 00 mov $0x0,%eax
0x80be8db <+0x0199> ba 00 00 00 00 mov $0x0,%edx
554 [1] }
0x80be8e0 <+0x019e> 8d 65 f4 lea -0xc(%ebp),%esp
0x80be8e3 <+0x01a1> 5b pop %ebx
0x80be8e4 <+0x01a2> 5e pop %esi
0x80be8e5 <+0x01a3> 5f pop %edi
0x80be8e6 <+0x01a4> 5d pop %ebp
0x80be8e7 <+0x01a5> c3 ret
Can anyone explain/suggest a fix for that?
Thanks a lot in advance
------------------
Hi, here we go :)
After compiling with DEBUG_AUDIO I run the app, and got a long list of logs of what's appening, just before the app stops or hungs:
37 s 236 ms :open()
37 s 359 ms :open()
defaults out of range
pmin= 21333 , pmax= 21334 , bmin= 42666 , bmax= 170667
used: buffer_time= 85332 , period_time= 21333
37 s 457 ms :userFeed() IN
read in bytes = 0 (frames=0)
37 s 460 ms :userFeed() OUT
frames to write out = 512 ( 1024 ) bytes
37 s 478 ms :updateAvailable()
frames to write out = 512 ( 1024 ) bytes
frames to write out = 512 ( 1024 ) bytes
frames to write out = 512 ( 1024 ) bytes
37 s 503 ms :updateAvailable()
37 s 509 ms :userFeed() OUT
37 s 524 ms :updateAvailable()
37 s 541 ms :updateAvailable()
37 s 544 ms :userFeed() IN
37 s 565 ms :updateAvailable()
37 s 566 ms :updateAvailable()
read in bytes = 1700 (frames=850)
frames to write to QIODevice = 850 ( 1700 ) bytes
frames to write out = 512 ( 1024 ) bytes
37 s 683 ms :updateAvailable()
... (long long list of similar logs) ...
frames to write out = 512 ( 1024 ) bytes
frames to write out = 512 ( 1024 ) bytes
39 s 10 ms :updateAvailable()
39 s 11 ms :userFeed() OUT
39 s 22 ms :updateAvailable()
39 s 26 ms :userFeed() OUT
39 s 36 ms :userFeed() IN
read in bytes = 680 (frames=340)
frames to write to QIODevice = 340 ( 680 ) bytes
39 s 44 ms :updateAvailable()
39 s 47 ms :userFeed() OUT
frames to write out = 512 ( 1024 ) bytes
frames to write out = 512 ( 1024 ) bytes
frames to write out = 512 ( 1024 ) bytes
39 s 66 ms :updateAvailable()
39 s 68 ms :userFeed() OUT
39 s 86 ms :updateAvailable()
39 s 89 ms :userFeed() IN
read in bytes = 1020 (frames=510)
frames to write to QIODevice = 510 ( 1020 ) bytes
39 s 99 ms :userFeed() OUT
39 s 116 ms :updateAvailable()
39 s 117 ms :userFeed() OUT
frames to write out = 512 ( 1024 ) bytes
frames to write out = 512 ( 1024 ) bytes
Actually I didn't find this very usefull, but if you wish I can send more and give you a more detailed description.
What I've found really strange (I'm not used to read assembly at all) is that when the SIGSEGV occurs the eip points at line 8x80be783 in this fragment:
525 [1] int space = bytesFree();
0x80be77b <+0x0039> 8b 45 08 mov 0x8(%ebp),%eax
0x80be77e <+0x003c> 8b 00 mov (%eax),%eax
0x80be780 <+0x003e> 83 c0 44 add $0x44,%eax
0x80be783 <+0x0041> 8b 00 mov (%eax),%eax
0x80be785 <+0x0043> 83 ec 0c sub $0xc,%esp
0x80be788 <+0x0046> ff 75 08 pushl 0x8(%ebp)
0x80be78b <+0x0049> ff d0 call *%eax
0x80be78d <+0x004b> 83 c4 10 add $0x10,%esp
0x80be790 <+0x004e> 89 45 e0 mov %eax,-0x20(%ebp)
(see entire fragment in my previous answer)
this seems to be a push in the stack just before calling "bytesFree()".
But why is deferencing %eax and than calling *%eax is behond my understanding
(in all other function call ther is a fixed memory address).
The really strange thing, hower, is that if I watch locals at that point:
int frames, err;
int space = bytesFree();
while when stopped at breakpoint "frames", "err" and "space" contain just rubbish,
when stopped after SIGSEGV they do have initialized values
(usually frames=1, err=-77, space=320). Does this make any sense??
However, as it seems that the device is stopped from some other thread
while inside this function, I've modified *qaudiooutput_asla_p.cpp*
and added a few check before trying to write to the audio device,
here's the pach:
522,525d519
< // tilly 20/04/2015: moved this two lines on top of function)
< if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState)
< return 0;
<
529,530c523,524
< // tilly 20/04/2015: (see above)
<
---
> if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState)
> return 0;
540,543d533
< // tilly 20/04/2015: added this two lines to check state before SIGEGV occurs!
< if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState)
< return 0;
<
784,787d773
< // tilly 20/04/2015: added this two lines
< if(!audioDevice)
< return 0;
<
792c778
< while(audioDevice && (written < len)) { // tilly 20/04/2015: added audioDevice test!
---
> while(written < len) {
796,797c782
< else // tilly 20/04/2015: added else [if ever chunk<0 (as not excluded by the test before) - adding to written would result in a mess probably..]
< written+=chunk;
---
> written+=chunk;
As I link to Qt statically, this gave my app a reasonable level of stability, so if audio stops I can just print an error message, but any further explaination on the cause of the SIGSEGV would be much appreciated.
What do you think about that?
================================================================================
ARCH FORUM
================================================================================
Audio devices list in qt-4 vs qt-5
----------------------------------
Hello,
I'm facing two very differents behaviors about audio, when using the last qt-4 vs qt-5 versions, from the official repositories, to link this [url=http://sourceforge.net/projects/viavoip/]simple Voip application[/url] against.
* qt4: When querying for input/output devices I get this list of devices:
[img=devlist-in-qt4.png]http://lnx.utillyty.eu/viavoip/xtra/devlist-in-qt4.png[/img]
[img=devlist-out-qt4.png]http://lnx.utillyty.eu/viavoip/xtra/devlist-out-qt4.png[/img]
* qt5: When querying for input/output devices I got this list
[img=devlist-in-qt5.png]http://lnx.utillyty.eu/viavoip/xtra/devlist-in-qt5.png[/img]
[img=devlist-out-qt5.png]http://lnx.utillyty.eu/viavoip/xtra/devlist-out-qt5.png[/img]
In both cases I started pulseaudio with -D option.
(If a shutdown pulseaudio the qt-5 device list remains the same, but the two alsa_input, alsa_output devices are not present, resulting in the problem I explain below).
Here is some usefull outputs:
[code]
$ aplay -L
--------------------------------------------------------------------------------
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
default
Default ALSA Output (currently PulseAudio Sound Server)
sysdefault:CARD=I82801DBICH4
Intel 82801DB-ICH4, Intel 82801DB-ICH4
Default Audio Device
front:CARD=I82801DBICH4,DEV=0
Intel 82801DB-ICH4, Intel 82801DB-ICH4
Front speakers
surround21:CARD=I82801DBICH4,DEV=0
Intel 82801DB-ICH4, Intel 82801DB-ICH4
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=I82801DBICH4,DEV=0
Intel 82801DB-ICH4, Intel 82801DB-ICH4
4.0 Surround output to Front and Rear speakers
surround41:CARD=I82801DBICH4,DEV=0
Intel 82801DB-ICH4, Intel 82801DB-ICH4
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=I82801DBICH4,DEV=0
Intel 82801DB-ICH4, Intel 82801DB-ICH4
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=I82801DBICH4,DEV=0
Intel 82801DB-ICH4, Intel 82801DB-ICH4
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
iec958:CARD=I82801DBICH4,DEV=0
Intel 82801DB-ICH4, Intel 82801DB-ICH4 - IEC958
IEC958 (S/PDIF) Digital Audio Output
[/code]
[code]
$ lsmod | grep '^snd' | column -t
--------------------------------------------------------------------------------
snd_intel8x0 34617 3
snd_intel8x0m 17500 0
snd_ac97_codec 96144 2 snd_intel8x0,snd_intel8x0m
snd_pcm 78142 3 snd_ac97_codec,snd_intel8x0,snd_intel8x0m
snd_timer 26106 1 snd_pcm
snd 55101 11 snd_ac97_codec,snd_intel8x0,snd_timer,snd_pcm,snd_intel8x0m
[/code]
[code]
$ ls -l /dev/snd
--------------------------------------------------------------------------------
total 0
drwxr-xr-x 2 root root 80 Apr 18 04:48 by-path
crw-rw----+ 1 root audio 116, 5 Apr 18 04:48 controlC0
crw-rw----+ 1 root audio 116, 2 Apr 18 04:48 controlC1
crw-rw----+ 1 root audio 116, 7 Apr 18 17:25 pcmC0D0c
crw-rw----+ 1 root audio 116, 6 Apr 18 17:25 pcmC0D0p
crw-rw----+ 1 root audio 116, 8 Apr 18 04:48 pcmC0D1c
crw-rw----+ 1 root audio 116, 9 Apr 18 04:48 pcmC0D2c
crw-rw----+ 1 root audio 116, 10 Apr 18 04:48 pcmC0D3c
crw-rw----+ 1 root audio 116, 11 Apr 18 04:58 pcmC0D4p
crw-rw----+ 1 root audio 116, 4 Apr 18 04:48 pcmC1D0c
crw-rw----+ 1 root audio 116, 3 Apr 18 04:48 pcmC1D0p
crw-rw----+ 1 root audio 116, 1 Apr 18 04:48 seq
crw-rw----+ 1 root audio 116, 33 Apr 18 04:48 timer
[/code]
I only uncommented the "autospawn = no" line in pulse/client.conf, leaving the rest of the "/etc/asound.conf" and "/etc/pulse/*.conf" files unchanged from the pacman repository.
Audio is working in both cases, but the only way to get the application working is to select the two distinct alsa_input and alsa_output devices hightlighted in the qt5 screenshot, otherwise after a few user interactions, the app crashes with SIGSEGV, as I reported in this [url=http://forum.qt.io/topic/53348/qaudiooutput-and-qaudioinput-on-linux-with-alsa]post[/url] in the Qt forum.
As I mentioned there I've also tried to rebuild qt 4.8.6 against pulse audio to see if I get the same devices list, but the lists remain still the same shown in the two first qt-4 pics above.
Thanks in advance for any help.
================================================================================
QT FORUM
================================================================================
Issues on android
QAudioInput works only in pushmode with voicerecognition
QAudioOutput works only in pull mode
often stops or idle