Sound not working on raspberry pi with Android Things
We recently rolled Android Things on a Raspberry Pi 3 and everything works great except for the sound. I have tried connecting 3.5mm headphone jack and hdmi screen, and also in various combinations such as:
- Headphones only without hdmi display.
- Only hdmi monitor.
- also plugged in earphone connected to raspberry pi 3.5 audio jack and hdmi display.
I tried all of this with adb command. Example:
adb shell am start -a android.intent.action.VIEW -d file:///sdcard/music/sample.mp3 -t audio/mp3
Alternatively later the code is also used:
MediaPlayer mPlayer = MediaPlayer.create(this.getBaseContext(), R.raw.humma);
mPlayer.setOnErrorListener(this);
mPlayer.start();
But in none of these conditions the sound worked.
Below is the console log:
OMXClient: MuxOMX ctor
04-24 06:08:15.256 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:15.258 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:15.259 157 157 I OMXMaster: makeComponentInstance(OMX.google.mp3.decoder) in mediacodec process
04-24 06:08:15.401 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:15.402 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:15.403 157 1277 I OMXMaster: makeComponentInstance(OMX.google.amrnb.decoder) in mediacodec process
04-24 06:08:15.423 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:15.423 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:15.424 157 1277 I OMXMaster: makeComponentInstance(OMX.google.amrwb.decoder) in mediacodec process
04-24 06:08:15.433 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:15.434 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:15.435 157 1277 I OMXMaster: makeComponentInstance(OMX.google.aac.decoder) in mediacodec process
04-24 06:08:15.462 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:15.463 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:15.463 157 206 I OMXMaster: makeComponentInstance(OMX.google.g711.alaw.decoder) in mediacodec process
04-24 06:08:15.593 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:15.594 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:15.594 157 206 I OMXMaster: makeComponentInstance(OMX.google.g711.mlaw.decoder) in mediacodec process
04-24 06:08:15.723 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:15.724 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:15.724 157 206 I OMXMaster: makeComponentInstance(OMX.google.vorbis.decoder) in mediacodec process
04-24 06:08:15.853 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:15.854 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:15.854 157 206 I OMXMaster: makeComponentInstance(OMX.google.opus.decoder) in mediacodec process
04-24 06:08:15.984 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:15.985 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:15.985 157 206 I OMXMaster: makeComponentInstance(OMX.google.raw.decoder) in mediacodec process
04-24 06:08:15.997 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:15.998 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:15.998 157 206 I OMXMaster: makeComponentInstance(OMX.google.aac.encoder) in mediacodec process
04-24 06:08:16.025 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:16.025 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:16.026 157 1278 I OMXMaster: makeComponentInstance(OMX.google.amrnb.encoder) in mediacodec process
04-24 06:08:16.042 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:16.042 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:16.043 157 1278 I OMXMaster: makeComponentInstance(OMX.google.amrwb.encoder) in mediacodec process
04-24 06:08:16.065 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:16.066 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:16.066 157 1278 I OMXMaster: makeComponentInstance(OMX.google.flac.encoder) in mediacodec process
04-24 06:08:16.167 1246 1257 I art : Background partial concurrent mark sweep GC freed 13776(3MB) AllocSpace objects, 18(360KB) LOS objects, 39% free, 2MB/3MB, paused 969us total 101.384ms
04-24 06:08:16.213 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:16.214 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:16.215 157 1278 I OMXMaster: makeComponentInstance(OMX.google.gsm.decoder) in mediacodec process
04-24 06:08:16.350 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:16.351 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:16.352 157 206 I OMXMaster: makeComponentInstance(OMX.google.mpeg4.decoder) in mediacodec process
04-24 06:08:16.391 1246 1246 I Choreographer: Skipped 54 frames! The application may be doing too much work on its main thread.
04-24 06:08:16.464 409 431 I ActivityManager: Displayed schneider_electric.com.mqttclient/.MainActivity: +23s558ms
04-24 06:08:16.485 409 471 I WindowManager: Destroying surface Surface(name=com.android.iotlauncher/com.android.iotlauncher.IoTLauncher) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.destroyOrSaveSurface:2073 com.android.server.wm.AppWindowToken.destroySurfaces:363 com.android.server.wm.AppWindowToken.notifyAppStopped:389 com.android.server.wm.WindowManagerService.notifyAppStopped:4456 com.android.server.am.ActivityStack.activityStoppedLocked:1252 com.android.server.am.ActivityManagerService.activityStopped:6902
04-24 06:08:16.500 157 1277 E OMXNodeInstance: getExtensionIndex(9d000f:google.mpeg4.decoder, OMX.google.android.index.configureVideoTunnelMode) ERROR: UnsupportedIndex(0x8000101a)
04-24 06:08:16.500 157 157 W OMXNodeInstance: [9d000f:google.mpeg4.decoder] component does not support metadata mode; using fallback
04-24 06:08:16.505 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:16.506 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:16.506 157 157 I OMXMaster: makeComponentInstance(OMX.google.h263.decoder) in mediacodec process
04-24 06:08:16.634 157 1277 E OMXNodeInstance: getExtensionIndex(9d0010:google.h263.decoder, OMX.google.android.index.configureVideoTunnelMode) ERROR: UnsupportedIndex(0x8000101a)
04-24 06:08:16.634 157 1277 W OMXNodeInstance: [9d0010:google.h263.decoder] component does not support metadata mode; using fallback
04-24 06:08:16.641 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:16.641 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:16.643 157 1277 I OMXMaster: makeComponentInstance(OMX.google.h264.decoder) in mediacodec process
04-24 06:08:16.720 409 431 I WindowManager: Destroying surface Surface(name=Starting schneider_electric.com.mqttclient) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.destroyOrSaveSurface:2073 com.android.server.wm.AppWindowToken.destroySurfaces:363 com.android.server.wm.WindowStateAnimator.finishExit:565 com.android.server.wm.WindowStateAnimator.stepAnimationLocked:491 com.android.server.wm.WindowAnimator.updateWindowsLocked:303 com.android.server.wm.WindowAnimator.animateLocked:704
04-24 06:08:16.788 160 1273 W ACodec : [OMX.google.h264.decoder] stopping checking profiles after 32: 2/8000
04-24 06:08:16.789 157 206 E OMXNodeInstance: getExtensionIndex(9d0011:google.h264.decoder, OMX.google.android.index.configureVideoTunnelMode) ERROR: UnsupportedIndex(0x8000101a)
04-24 06:08:16.789 157 1277 W OMXNodeInstance: [9d0011:google.h264.decoder] component does not support metadata mode; using fallback
04-24 06:08:16.796 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:16.797 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:16.797 157 1277 I OMXMaster: makeComponentInstance(OMX.google.hevc.decoder) in mediacodec process
04-24 06:08:16.943 157 1277 E OMXNodeInstance: getExtensionIndex(9d0012:google.hevc.decoder, OMX.google.android.index.configureVideoTunnelMode) ERROR: UnsupportedIndex(0x8000101a)
04-24 06:08:16.943 157 157 W OMXNodeInstance: [9d0012:google.hevc.decoder] component does not support metadata mode; using fallback
04-24 06:08:16.949 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:16.950 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:16.950 157 157 I OMXMaster: makeComponentInstance(OMX.google.vp8.decoder) in mediacodec process
04-24 06:08:17.078 157 1277 E OMXNodeInstance: getExtensionIndex(9d0013:google.vp8.decoder, OMX.google.android.index.configureVideoTunnelMode) ERROR: UnsupportedIndex(0x8000101a)
04-24 06:08:17.079 157 1277 W OMXNodeInstance: [9d0013:google.vp8.decoder] component does not support metadata mode; using fallback
04-24 06:08:17.084 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:17.084 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:17.085 157 1277 I OMXMaster: makeComponentInstance(OMX.google.vp9.decoder) in mediacodec process
04-24 06:08:17.177 1246 1308 D AlarmPingSender: Register alarmreceiver to MqttServiceMqttService.pingSender.02:00:00:00:00:00-pub
04-24 06:08:17.184 1246 1308 D AlarmPingSender: Schedule next alarm at 1493014157183
04-24 06:08:17.186 1246 1308 D AlarmPingSender: Alarm scheule using setExactAndAllowWhileIdle, next: 60000
04-24 06:08:17.219 157 1278 E OMXNodeInstance: getExtensionIndex(9d0014:google.vp9.decoder, OMX.google.android.index.configureVideoTunnelMode) ERROR: UnsupportedIndex(0x8000101a)
04-24 06:08:17.219 157 157 W OMXNodeInstance: [9d0014:google.vp9.decoder] component does not support metadata mode; using fallback
04-24 06:08:17.225 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:17.227 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:17.227 157 157 I OMXMaster: makeComponentInstance(OMX.google.h263.encoder) in mediacodec process
04-24 06:08:17.365 157 157 I SoftMPEG4Encoder: Construct SoftMPEG4Encoder
04-24 06:08:17.369 160 1273 W ACodec : do not know color format 0x7f000789 = 2130708361
04-24 06:08:17.370 157 1277 E OMXNodeInstance: getConfig(9d0015:google.h263.encoder, ConfigAndroidIntraRefresh(0x6f60000a)) ERROR: Undefined(0x80001001)
04-24 06:08:17.375 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:17.376 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:17.376 157 157 I OMXMaster: makeComponentInstance(OMX.google.h264.encoder) in mediacodec process
04-24 06:08:17.514 160 1273 W ACodec : do not know color format 0x7f000789 = 2130708361
04-24 06:08:17.519 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:17.520 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:17.520 157 1278 I OMXMaster: makeComponentInstance(OMX.google.mpeg4.encoder) in mediacodec process
04-24 06:08:17.641 157 1278 I SoftMPEG4Encoder: Construct SoftMPEG4Encoder
04-24 06:08:17.645 160 1273 W ACodec : do not know color format 0x7f000789 = 2130708361
04-24 06:08:17.646 157 1277 E OMXNodeInstance: getConfig(9d0017:google.mpeg4.encoder, ConfigAndroidIntraRefresh(0x6f60000a)) ERROR: Undefined(0x80001001)
04-24 06:08:17.651 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:17.652 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:17.652 157 206 I OMXMaster: makeComponentInstance(OMX.google.vp8.encoder) in mediacodec process
04-24 06:08:17.786 160 1273 W ACodec : do not know color format 0x7f000789 = 2130708361
04-24 06:08:17.787 157 1277 E OMXNodeInstance: getConfig(9d0018:google.vp8.encoder, ConfigAndroidIntraRefresh(0x6f60000a)) ERROR: Undefined(0x80001001)
04-24 06:08:17.792 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:17.792 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:17.792 160 1273 W MediaCodecList: unable to open media codecs configuration xml file: /etc/media_codecs_performance.xml
04-24 06:08:17.793 160 1273 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:17.794 160 1273 I OMXClient: MuxOMX ctor
04-24 06:08:17.799 160 1273 W MediaCodecList: unable to open media codecs configuration xml file: /data/misc/media/media_codecs_profiling_results.xml
04-24 06:08:17.800 160 1274 I MediaPlayerService: MediaPlayerService::getOMX
04-24 06:08:17.801 160 1274 I OMXClient: MuxOMX ctor
04-24 06:08:17.801 157 1277 I OMXMaster: makeComponentInstance(OMX.google.mp3.decoder) in mediacodec process
04-24 06:08:17.918 157 1278 E OMXNodeInstance: setConfig(9d0019:google.mp3.decoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
04-24 06:08:17.918 160 1274 I ACodec : codec does not support config priority (err -2147483648)
04-24 06:08:17.922 160 1274 I MediaCodec: MediaCodec will operate in async mode
04-24 06:08:17.946 160 1272 D AudioTrack: Client defaulted notificationFrames to 7520 for frameCount 22560
04-24 06:08:17.949 160 1267 D NuPlayerDriver: notifyListener_l(0xa810c000), (6, 0, 0), loop setting(0, 0)
04-24 06:08:41.720 170 170 I update_engine: [0424/060841:INFO:update_manager-inl.h(52)] ChromeOSPolicy::UpdateCheckAllowed: START
04-24 06:08:41.721 170 170 I update_engine: [0424/060841:INFO:chromeos_policy.cc(322)] Allowing update check.
Please help me.
source to share
adb shell am start -a android.intent.action.VIEW
Tells Android about the intention to activate the action VIEW
on "Play mp3". AndroidThings is not like Android AOSP - it has no built-in apps. Therefore it doesn't have an app that can VIEW
play MP3.
To play mp3 in your application, you need to make sure the file is compatible with the system. See here for supported media formats
If that's okay, you have the correct code to play the media file ( more details here ). Then you should check the logs to see if it plays.
source to share
I suspect it has something to do with the following audio management API: https://developer.android.com/things/sdk/drivers/audio.html
source to share