I have a Qt code with a QSound object that is supposed to read two wav files on a thread.
My code works on iOS simulator, but not on Android.
My thread code that reads wav files :
ClickThread::ClickThread(): highClickFile("://high_click.wav"), lowClickFile("://low_click.wav"), isRunning(false)
{
this->highClick = new QSound(highClickFile);
this->lowClick = new QSound(lowClickFile);
this->setPeriod(120);
}
void ClickThread::process(){
while(this->isRunning == true)
{ if(!this->isRunning) break;
highClick->play();
QThread::msleep(period);
highClick->stop();
if(!this->isRunning) break;
lowClick->play();
QThread::msleep(period);
lowClick->stop();
if(!this->isRunning) break;
lowClick->play();
QThread::msleep(period);
lowClick->stop();
if(!this->isRunning) break;
lowClick->play();
QThread::msleep(period);
lowClick->stop();
}
}
There is the error message I got :
W linker : Warning: "/data/data/org.qtproject.example.MyProject/qt-reserved-files/plugins/audio/libqtaudio_opensles.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
D : PlayerBase::PlayerBase()
D : TrackPlayerBase::TrackPlayerBase()
I libOpenSLES: Emulating old channel mask behavior (ignoring positional mask 0x4, using default mask 0x1 based on channel count of 1)
I AudioTrack: createTrack_l(0): AUDIO_OUTPUT_FLAG_FAST successful; frameCount 0 -> 1322
E android.media.AudioTrack: getMinBufferSize(): Invalid audio format.
W libc : malloc(4294967292) failed: returning null pointer
F libc : /Volumes/Android/buildbot/src/android/ndk-release-r20/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type std::bad_alloc: std::bad_alloc" failed
F libc : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 7670 (QtThread), pid 6740 (.MyProject)
Thanks for your answers
P
EDIT :
The problem was that my wav file was encoded in 24 bits. Android doesn't seem to use this kind of encoding for PCM files, referring to this website :
https://developer.android.com/reference/android/media/AudioFormat
we only can have 8, 16 or 32 bits.
So, I used FFmpeg to encode my wav files in 16 bits and now my code works !
Check that link for an exemple of encoding with FFmpeg :
ffmpeg FLAC 24 bit 96khz to 16 bit 48khz
Pierre.
Related
We recently implemented CameraX to take images instead of using the device camera. Since the time we rolled out this feature in our app, we are seeing the following error. Can someone help debug this issue? I have tried googling this error but could not find any resources online.
RuntimeException lock buffer failed for format 0x21
android.media.ImageReader$SurfaceImage in nativeCreatePlanes
android.media.ImageReader$SurfaceImage in getPlanes at line 1004
androidx.camera.core.AndroidImageProxy in <init> at line 51
androidx.camera.core.AndroidImageReaderProxy in acquireNextImage at line 102
androidx.camera.core.MetadataImageReader in imageIncoming at line 322
I have an application (decoding module) which fails to create mediacodec for decoding H264 encoded stream while running on the Nexus 6P. But it perfectly works under Google PIXEL XL phone.
I am also giving a small snap of the error I am getting while I debug it using android studio logcat. Any Help will be highly appreciated.
Error Snap
E/OMX-VDEC-1080P: Failed to call stream on OUTPUT due to HW_OVERLOAD
E/OMX-VDEC-1080P: empty_this_buffer_proxy failure due to HW overload
E/OMX-VDEC-1080P: ERROR: Sending OMX_ErrorInsufficientResources to Client
E/OMX-VDEC-1080P: Failed to qbuf to driver
E/ACodec: [OMX.qcom.video.decoder.avc] ERROR(0x80001000)
E/ACodec: signalError(omxError 0x80001000, internalError -2147483648)
Codec reported err 0x80001000, actionCode 0, while in state 6
E/NuPlayerDecoder: Decoder (video) reported error : 0x80001000
E/NuPlayer: received error(0x80001000) from video decoder, flushing(0), now shutting down
E/MediaPlayer: error (1, -2147479552)
E/MediaPlayer: Error (1,-2147479552)
D/EasyMovieTexture: OnError
E/NuPlayerDecoder: failed to flush OMX.qcom.video.decoder.avc (err=-38)
12-29 20:21:41.075 2737-10644/? E/NuPlayer: received error(0xffffffda) from video decoder, flushing(2), now shutting down
D/NuPlayerDriver: notifyListener_l(0xeed2aae0), (100, 1, -38), loop setting(0, 0)
E/MediaPlayer: Error (1,-38)
D/EasyMovieTexture: OnError
E/OMX-VDEC-1080P: Failed to call stream on OUTPUT
E/OMX-VDEC-1080P: empty_this_buffer_proxy failure
I guess error code -38 is coming because I want to start the mediaplayer in an incorrect state (Here as the codec is giving me an error, mediaplayer is in the ERROR state).
I tested on Google PIXEL XL and Nexus 6P and I am getting this problem for Nexus 6P.
Iam trying to port Android Lollipop on arndale board and I am facing following issue regarding ART crash (AndroidRunTime).
> I/art ( 2264): RelocateImage: /system/bin/patchoat
> --input-image-location=/system/framework/boot.art --output-image-file=/data/dalvik-cach6 F/libc ( 2443): No [stack] line found in "/proc/self/task/2443/maps"! F/libc ( 2443): Fatal signal 6
> (SIGABRT), code -6 in tid 2443 (patchoat) W/art ( 2702): Could not
> create image space with image file >/system/framework/boot.art.
> Attempting to fall back to imageless running
STEPS FOLLOWED FOR PORTING
1.Download vexpress android L 32 bit code from below link.
http://releases.linaro.org/15.05/android
2.Download arndale android KK 32 bit source with 3.9 kernel from http://releases.linaro.org/14.08/android/arndale
3.Replace the Vexpress kernel source from code download in step 1 with arndale KK 3.9 Kernel source downloaded from step2.
4.Replace Vexpress HAL (device/linaro/vexpress) with Arndale HAL (device/linaro/arndale).
5.Solve minor complilation issues related to bionic and build environment.
After flashing the images and powering on the board I am stuck at android logo and kernel crashes
> >37.790000] Internal error: Oops: 5 [#1] PREEMPT SMP ARM Modules linked in: CPU: 0 Tainted: G W (3.9.1 #8) [ 37.790000]
> CPU: 0 Tainted: G W (3.9.1 #8) PC is at
> __copy_to_user_std+0x4c/0x3a8 [ 37.790000] PC is at __copy_to_user_std+0x4c/0x3a8 LR is at 0x6c000000
> >[ 37.790000] LR is at 0x6c000000
and logcat gives
> >I/art ( 2264): RelocateImage: /system/bin/patchoat --input-image-location=/system/framework/boot.art --output-image-file=/data/dalvik-cach6 F/libc ( 2443): No [stack] line found in "/proc/self/task/2443/maps"! F/libc ( 2443): Fatal signal 6
> (SIGABRT), code -6 in tid 2443 (patchoat) W/art ( 2702): Could not
> create image space with image file >/system/framework/boot.art.
> Attempting to fall back to imageless running.
POINT OF EXACT FAILURE
1.ART calls Thread::InitStackHwm from art/runtime/thread.cc.
2.The above call triggers __pthread_attr_getstack_main_thread(stack_base, stack_size) in bionic/libc/bionic/pthread_attr.cpp which returns No [stack] line found in enter code here/proc/self/task/2443/maps! and ART crashes giving SIG_ABORT and it seems as if no stack is getting created for 2443 thread, but how to solve this?
It would be great if anyone can help me to solve this issue.
Thanks,
Devarsh
This is a side effect of using 3.9 kernel with linaro vexpress android platform which is expecting 3.10 kernel(whose support for arndale is not available).
As a workaround comment out the InitStackHwm() function in art/runtime/thread.cc.
I think if in 3.10 kernel support of arndale is needed we may not need this workaround and ART would work straightaway.
void Thread::Init(ThreadList* thread_list, JavaVMExt* java_vm) {
// This function does all the initialization that must be run by the native thread it applies to.
// (When we create a new thread from managed code, we allocate the Thread* in Thread::Create so
// we can handshake with the corresponding native thread when it's ready.) Check this native
// thread hasn't been through here already...
CHECK(Thread::Current() == nullptr);
SetUpAlternateSignalStack();
InitCpu();
InitTlsEntryPoints();
RemoveSuspendTrigger();
InitCardTable();
InitTid();
// Set pthread_self_ ahead of pthread_setspecific, that makes Thread::Current function, this
// avoids pthread_self_ ever being invalid when discovered from Thread::Current().
tlsPtr_.pthread_self = pthread_self();
CHECK(is_started_);
CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, this), "attach self");
DCHECK_EQ(Thread::Current(), this);
tls32_.thin_lock_thread_id = thread_list->AllocThreadId(this);
//InitStackHwm(); This is the workaround
tlsPtr_.jni_env = new JNIEnvExt(this, java_vm);
thread_list->Register(this);
}
I am trying to build my own Cyanogenmod 11 image. I am using this link: How To Build CyanogenMod Android for Samsung Galaxy Note 3 LTE ("hlte")
And I get the following error message:
make: *** No rule to make target `vendor/samsung/hlte/proprietary/lib/cdma/libsec-ril.so', needed by `/root/android/system/out/target/product/hlte/system/lib/cdma/libsec-ril.so'. Stop.
make: *** Waiting for unfinished jobs....
external/vim/src/spell.c: In function 'put_sugtime':
external/vim/src/spell.c:7869:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Let me know if you want me to post the make file. I can not imaging there not being a rule as this libsec-ril.so is related to the radio. Am I right?
Thanks to Dan, I found these errors when I try to pull files from my device, which runs the same version as I am trying to build i.e. Cyanogenmod 11. I posted a few of the other ones which adb pulled successfully also....
Extracting /system/vendor/lib/libmm-color-convertor.so ...
152 KB/s (9308 bytes in 0.059s)
Extracting /system/lib/cdma/libsec-ril.so ...
remote object '/system/lib/cdma/libsec-ril.so' does not exist
remote object '/system/lib/cdma/libsec-ril.so' does not exist
Extracting /system/lib/cdma/libril.so ...
remote object '/system/lib/cdma/libril.so' does not exist
remote object '/system/lib/cdma/libril.so' does not exist
Extracting /system/lib/gsm/libsec-ril.so ...
remote object '/system/lib/gsm/libsec-ril.so' does not exist
remote object '/system/lib/gsm/libsec-ril.so' does not exist
Extracting /system/lib/gsm/libril.so ...
remote object '/system/lib/gsm/libril.so' does not exist
remote object '/system/lib/gsm/libril.so' does not exist
Extracting /system/lib/libsensirion_h_2.so ...
673 KB/s (776792 bytes in 1.126s)
Extracting /system/lib/hw/sensors.msm8974.so ...
337 KB/s (62816 bytes in 0.181s)
Extracting /system/bin/ds_fmc_appd ...
402 KB/s (58776 bytes in 0.142s)
I found another post about the same question here: Can't build Cyanogenmod. The solution was to get the file from Git. Thanks for the help.
My Android application (using native library) print this warning on Android 4.4 :
linker mylib.so has text relocations. This is wasting memory and is a security risk. Please fix.
Have you got an idea of what it is and how to fix it ?
Thanks,
This would appear to be a result of two ndk-gcc bugs mentioned at https://code.google.com/p/android/issues/detail?id=23203
and stated there to have been fixed as of ndk-r8c.
It would appear that the check for libraries with the issue has been added only recently.
Note: please do not edit this post to hide the link URL. It is explicit because the destination is what makes it authoritative.
Further Note Changing NDK versions is only a fix when the warning is due to the code of your application. It will have no effect if the warning is instead on a system component such as libdvm - that can only be fixed by a system update.
You need to make the code in your library position independent...add -fpic or -fPIC to your LOCALC_FLAGS in your Android.mk and you also need to ensure that you're not linking against any static or shared libraries that contain text relocations themselves. If they do and you can re-compile them, use one of the flags mentioned above.
In short, you need to compile your library with one of the -fpic or -fPIC flags, where PIC is an abbreviation for Position Independent Code.
The longer answer is that your yourlib.so has been compiled in a manner that does not conform to the Google Android standard for an ELF file, where this Dynamic Array Tag entry is unexpected. In the best case the library will still run, but it is still an error and future AOS version will probably not allow it to run.
DT_TEXTREL 0x16 (22)
To check whats in you library use something along the line of:
# readelf --wide -S yourlib.so
There are 37 section headers, starting at offset 0x40:
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 0000000000000000 002400 068f80 00 AX 0 0 16
[ 2] .rodata PROGBITS 0000000000000000 06b380 05ad00 00 WA 0 0 32
...
[16] .rela.text RELA 0000000000000000 26b8e8 023040 18 14 1 8
...
[36] .rela.debug_frame RELA 0000000000000000 25a608 0112e0 18 14 27 8
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
Please see my extensive answer on the topic, for more DT entry details. For details how to write proper dynamic libraries this is a must-read.
I got the same error with my application.
The application was using a native daemon that used a native library which was not implementing all the functions in its header file. When I added the required implementations to the native library everything just worked.
I don't know if you have the exact same issue but it just probably means the your native side has some mismatch.