Android: pcm_open failed cannot open device '/dev/snd/pcmC0D1p' - android

A custom piece of hardware is running Android with the audio drivers installed.
An simple Android app is created to play some audio using media player, the app is tested on a emulator so it works for sure.
When running the device on the hardware, error message from logcat displays the following many times:
01-01 01:09:16.355 2792-3186/? E/audio_hw_primary﹕ pcm_open(PCM_CARD) failed: cannot open device '/dev/snd/pcmC0D1p': No such file or directory
01-01 01:09:16.375 2792-3186/? E/audio_hw_primary﹕ pcm_open(PCM_CARD) failed: cannot open device '/dev/snd/pcmC0D1p': No such file or directory
01-01 01:09:16.435 2792-375/? E/AudioSink﹕ received unknown event type: 1 inside CallbackWrapper !
under /dev/snd/ there are
controlC0
pcmC0D0c
pcmC0D0p
timer
I am able to play system notifications without any problem. I could also hack the problem by creating a symbolic link pcmC0D1p pointing to pcmC0D0p, and it works. Why is android trying to play non-system sound track on pcmC0D1p? Who is controlling which output it goes to?

pcmC0D1p means :
pcm
Card 0
Device 1
Capture/Playback p
Clearly, whatever the node your app is accessing is not present as seen through your ls /dev/snd/.
Normally, if you are playing non-standard sounds like mp3 files, writing to AudioTrack, will handle everything.
If you see only one playback node by doing ls /dev/snd, it means you have only one playback node present, which I think (not sure though) is occupied for standard android sounds.

If "pcmC0D1p" device is present in /dev/snd then try to give permission with command
chmod 777 /dev/snd/pcmC0D1p
If it is still not working then this sound card is not available.

Related

Modifying wpa_Supplicant TB-X304F_

I have 285 different networks between the different campus apartments for which I am trying to add network profile information to a series of Lenovo Tab4 10 TB-X304F so they may connect without having our Apartment Managers carry around a list of wifi passwords.
So far, I have created a custom wpa_supplicant.conf file with all of the network blocks for each of the networks across the campus. I have rooted the device. I have pushed this custom file to /sdcard/TWRP. I then copied the file from /sdcard/TWRP to /data/misc/wifi.
Now we run into my issue, it appears that this file is stored in at least 3 locations which I have currently found, /etc/wifi, /system/etc/wifi and /data/misc/wifi. The other part of the problem is that these files appear to be rewritten/overwritten on boot.
Which of these file locations should I be updating with my custom wpa_supplicant.conf file? How do I stop the file from being rebuilt on boot? Or, how do I make the process, which builds the file on boot, build it with the networks I want added?
Am I missing any other steps?
I have also tried running " wpa_supplicant -iwlan0 -c/sdcard/TWRP/wpa_supplicant.conf -B " as a command in the adb shell with super user permissions and didn't receive any output or confirmation. What am I misunderstanding about the wpa_supplicant command?
Just in case here are the settings currently in /data/misc/wifi/wpa_supplicant.conf which I have copied into my custom file:
ctrl_interface=/data/misc/wifi/sockets
disable_scan_offload=1
driver_param=use_p2p_group_interface=1
update_config=1
device_name=LenovoTB-X304F
manufacturer=LENOVO
model_name=Lenovo TB-X304F
model_number=Lenovo TB-X304F
serial_number=<SerialNumber>
device_type=10-0050F204-5
config_methods=physical_display virtual_push_button
p2p_disabled=1
pmf=1
external_sim=1
tdls_external_control=1
I do not really know much, but I can successfully edit/replace
/data/misc/wifi/wpa_supplicant.conf
provided that (1) I have the device in Aeroplane Mode and (2) I make sure that the file belongs to user "system" and group "wifi", and has permissions 660. If I forget (1) or (2), somehow the file reverts later to the one before editing/replacing or is reinitialized to virtually empty (I am not sure when either happened exactly, but I noticed both cases). I believe your use of TWRP is effectively equivalent to my use of Aeroplane Mode--but I am not aware that you can "chown" a file in TWRP. I never had to touch any of the other locations where the file can apparently be found.
For reference, the commands to get the right ownership and permissions should be
chmod 660 /data/misc/wifi/wpa_supplicant.conf
chown system:wifi /data/misc/wifi/wpa_supplicant.conf
Of course, all this needs one to be root.

Android 7.0 init.rc mediaserver

I have question about Android 7.0 boot sequence.
In Android 6.0, the init process will parse the init.rc and initiate the mediaserver:
service media /system/bin/mediaserver
class main
user main
group audio camera inet net_bt net_bt_admin net_bw_acct drmrpc mediadrm qcom_diag radio cw_access
...
But in Android 7.0, the init.rc doesn't have the above code, so i wondering who is the one initiate the mediaserver?? could be systemserver or not?
Try to find a file named mediaserver.rc in frameworks/native. Android 7.0 tryes to separate the init.rc actions and services according to reason. And you'll find them in system/etc/init/ on the device.

Chromecast status code 2100 / Fails with local server

I'm using a local server on my Android device to cast images + mp4s to Chromecast.
(I tried both - NanoHttpD and AndroidAsyncHttpServer) https://github.com/MikeMitterer/android-cromecastsample/tree/master/src/main/java/at/mikemitterer/mobile/chromecastsample/cast (GH-Repo)) but if I server the files from one of these local servers I get Status{statusCode=unknown status code: 2100, resolution=null}
Serving the files from an external server works - at least with a MP4-File.
This is the the server I'm currently using: https://github.com/MikeMitterer/android-cromecastsample/blob/master/src/main/java/at/mikemitterer/mobile/chromecastsample/cast/CastAsyncFileServer.java
The Activity that initializes everything: https://github.com/MikeMitterer/android-cromecastsample/blob/master/src/main/java/at/mikemitterer/mobile/chromecastsample/ui/MainActivity.java
and my buildMediaInfo-function: https://github.com/MikeMitterer/android-cromecastsample/blob/master/src/main/java/at/mikemitterer/mobile/chromecastsample/ui/MainActivity.java#L317-L341
This shows how the sample app looks like:
Clicking on one of the images triggers the loadRemoteMedia -> buildMediaInfo.
I'm using the Chromecast V1 (old) Device on a 22" Monitor (No Audio with HDMI to DVI Converter) Streaming with other Apps than mine works. Im using the sample-app ID (4F8B3483) for testing.
BTW: (my second problem) If I use my own registered ID Chromecast connects fine but automatically disconnects after approximately 20secs...
I'm a bit lost - please help!
[Update]
Thanks to # Ali Naddaf I re-registered my Application!!! not the device! I changed from "Remote Display Receiver" to "Styled Media Receiver" waited ~15mins turned off/on Chromecast now debugging works and my second problem, that Chromecast automatically disconnected after ~20secs, is also solved. Cool!
If you check my SS you can see that my image is set as background for the video-tag. Is this the way it should work or I am doing something wrong?

Listening on socket under Android with C++ app

I would need to create C++ console application that runs under non-privileged user under Android 5 (rooted). This application listens on some socket port and accepts connections. It is implemented with boost::asio. When application runs as a root, then everything works. When it runs as an ordinary user, then application crashes when it tries to open acceptor:
const boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::address::from_string("127.0.0.1"), 3784);
boost::asio::ip::tcp::acceptor acceptor(ioService);
acceptor.open(endpoint.protocol()); // Here it throws an exception
The exception is a bit confusing but probably it means that I don't have access rights to touch sockets:
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
what(): open: Permission denied
Aborted
I tried to run application under user shell and under user media. I also tried to run it under user u0_a83, that is assigned to ProxyDroid on my device.
I changed /system/etc/permissions/platform.xml -- I assigned permission android.permission.INTERNET to user shell and media . I also tried to add group media to android.permission.INTERNET, but nothing has helped.
Btw. this is a special case when I really need to implement application in C++ to run under Android. Implementation in Java is not acceptable in my project.
It seems that the best solution is to use users that are predefined in Android and corresponds to capabilities available on the system: https://android.googlesource.com/platform/system/core/+/master/include/private/android_filesystem_config.h . In my case I can run the app under user inet (3003) that can create sockets.

RTSP 1080p live-streaming android client gets error (100,0)

My new surveillance camera just arrived, so I'm trying to write an app to live stream the video from it.
Since it came with basically no documentation, I installed the 'onvifer' android app which allows you to browse the camera's capabilities. This app works fine - gets the video and allows PTZ controls, etc. It reports the streaming url as:
rtsp://192.1.0.193:554/mpeg4
I tested the stream in the VLC windows client, and it's able to stream video from that URL as well. This makes me comfortable that the network is working OK.
The camera states the feed will be 1920x1080; VLC confirms this.
The basic code in my activity:
VideoView videoView = (VideoView)this.findViewById(R.id.VideoView);
videoView.setVideoURI(Uri.parse("rtsp://192.1.0.193:554/mpeg4"));
videoView.requestFocus();
videoView.start();
I've also given the app INTERNET permissions in AndroidManifest.xml, disabled authentication on the camera, and am running on a real device (not the emulator).
When I run the app, LogCat shows this immediately:
setDataSource IOException happend :
java.io.FileNotFoundException: No content provider: rtsp://192.1.0.193:554/mpeg4
at android.content.ContentResolver.openTypedAssetFileDescriptor (ContentResolver.java).
About 15 seconds later, the app shows a "Can't play this video" modal dialog box and this is added to LogCat:
MediaPlayer error (100, 0)
AudioSystem AudioFlinger server died!
MediaPlayer error (100, 0)
VideoView Error: 100,0
I've googled everything I can think of, but haven't found anything useful.
Any thoughts?
wild-ass-guess on your logcat and the RC=100... No SDP file or no equivalent for RTSP of the 'moov atom' block required to negotiate details of the stream /container/ codec/ format... You can get the AOSP code for mediaPlayer/videoView and grep the RC value in the source.
RTSP is gnarly to debug ( note the tools links ) and not assured to run inside a NAT'd network due to UDP issues. So, to get better result, you may have to look into forcing your config to do data channel on TCP an not UDP. Or it could be other issues , of which there are many.
If you really want to investigate, some possible tools below:
Use command line and CURL client to request your stream:
Android - Java RTSP Session Mgmt package on Git
Protocol dumps for CLI RTSP sessions to Youtube RTSP/SDP streams
To pursue the issue, you may need to get into the weeds with debug tools that track details of the protocol negotiation that preceeds the MediaPlayer actually starting play on the stream. That would include learning the RFP and the protocol details.
videoView.setVideoURI(“rtsp://192.1.0.193:554/mpeg4”);
Try your app on another phone.
You may find the problem is about the mobile device.
Try this
path:"rtsp://218.204.223.237:554/mobile/1/4C024DFE77DC717D/onnuvesj43xj7t26.sdp".
See whether the code has something wrong.

Categories

Resources