SlideShare a Scribd company logo
1 of 49
Download to read offline
1
Android's Multimedia
Framework
September 2014
Karim Yaghmour
@karimyaghmour
karim.yaghmour@opersys.com
2
These slides are made available to you under a Creative Commons Share-
Alike 3.0 license. The full terms of this license are here:
https://creativecommons.org/licenses/by-sa/3.0/
Attribution requirements and misc., PLEASE READ:
● This slide must remain as-is in this specific location (slide #2), everything
else you are free to change; including the logo :-)
● Use of figures in other documents must feature the below “Originals at”
URL immediately under that figure and the below copyright notice where
appropriate.
● You are free to fill in the “Delivered and/or customized by” space on the
right as you see fit.
● You are FORBIDEN from using the default “About” slide as-is or any of its
contents.
●
You are FORBIDEN from using any content provided by 3rd
parties without
the EXPLICIT consent from those parties.
(C) Copyright 2013-2014, Opersys inc.
These slides created by: Karim Yaghmour
Originals at: www.opersys.com/community/docs
Delivered and/or customized by
3
About
● Author of:
● Introduced Linux Trace Toolkit in 1999
● Originated Adeos and relayfs (kernel/relay.c)
● Training, Custom Dev, Consulting, ...
4
Agenda
● Architecture Basics
● Display Core
● Multimedia Architecture
● App Dev Model
● Kernel Drivers
● HAL definitions
● HAL modules
● System Services
● Stagefright
● Walkthrough
● Relevant Apps
● References and Pointers
5
1. Architecture Basics
● Hardware used to run Android
● AOSP
● Binder
● System Services
● HAL
6
7
8
9
10
11
/frameworks/base/services/java/...
/frameworks/base/services/jni/
/hardware/libhardware/
/device/[MANUF.]/[DEVICE]
/sdk/emulator/
Kernel or module
/frameworks/base/core/...
AOSP-provided
ASL
Manuf.-provided
Manuf. license
Manuf.-provided
GPL-license
12
2. Display Core
● Display Hardware
● Display stack in Android
● Kernel driver
● HAL definition
● HAL module
● Surface Flinger
● Window Manager
13
2.1. Display Hardware
MMU
IOMMU
14
2.2. Display stack in Android
15
16
From source.android.com - CC-BY 2.5
17
From source.android.com - CC-BY 2.5
18
2.3. Kernel driver
●
Video memory management
●
Mode setting
● Checking of parameters
● Motorola Xoom:
●
/dev/nvhdcp1
● /dev/nvhost-ctrl
● /dev/nvhost-display
● /dev/nvhost-dsi
●
/dev/nvhost-gr2d
● /dev/nvhost-gr3d
●
/dev/nvhost-isp
●
/dev/nvhost-mpe
● /dev/nvhost-vi
● /dev/nvmap
● /dev/tegra-crypto
●
/dev/tegra_avp
●
/dev/tegra_camera
●
/dev/tegra_fuse
● /dev/tegra_rpc
● /dev/tegra_sema
● ... whatever hides in hwcomposer HAL module
19
2.3. HAL Definition
● /hardware/libhardware/include/hardware/hwcomposer.h
● struct hwc_procs:
● invalidate()
● vsync()
● struct hwc_composer_device:
● prepare()
● set()
● dump()
● registerProcs()
● query()
● *()
20
2.5. HAL module
● Skeleton /hardware/libhardware/modules/hwcomposer.cpp
● /system/lib/hw/hwcomposer.BOARD.so
● /system/lib/hw/gralloc.BOARD.so
● Ex. - Mot Xoom:
● hwcomposer.tegra.so
● gralloc.tegra.so
● Surface Flinger hook:
● /frameworks/native/services/surfaceflinger/DisplayHardware
– HWComposer.cpp
– Provides fake vsync if none is provided in HW
21
2.6. Surface Flinger
● Actual server:
● /frameworks/native/services/surfaceflinger
● Client side:
● /frameworks/native/libs/gui
● Client / Server interface:
● ISurfaceComposerClient.cpp
● ISurfaceComposer.cpp
● This is NOT an aidl'ed service
● All communication is manually
marshalled/unmarshalled
22
2.7. Window Manager
● Server side:
● /frameworks/base/services/java/com/android/server/wm/
– WindowManagerService.java
– Session.java
● Client side:
● /frameworks/base/core/java/android/view/
– WindowManager.java
– WindowManagerImpl.java
– ViewRootImpl.java
● Interfaces:
● IWindowManager.aidl
● IWindowSession.aidl
● Parameters (incl. z-order):
● See WindowManager.java
23
3. Multimedia Architecture
● OpenMAX
● Media Playback
● Audio
● Camera
24
3.1. OpenMAX
From Khronos website
25
3.2. Media Playback
From source.android.com - CC-BY 2.5
26
3.3. Audio
From source.android.com - CC-BY 2.5
27
3.4. Camera
From source.android.com - CC-BY 2.5
28
From source.android.com - CC-BY 2.5
29
From source.android.com - CC-BY 2.5
30
4. App Dev Model
● Media Playback
● Audio Record
● Camera
31
4.1. Media Playback
● developer.android.com sample:
Uri myUri = ....; // initialize Uri here
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(getApplicationContext(), myUri);
mediaPlayer.prepare();
mediaPlayer.start();
32
From developer.android.com - ASL
33
4.2. Audio Record
● developer.android.com steps:
● Create a new instance of android.media.MediaRecorder.
● Set the audio source using MediaRecorder.setAudioSource(). You will probably
want to use MediaRecorder.AudioSource.MIC.
● Set output file format using MediaRecorder.setOutputFormat().
● Set output file name using MediaRecorder.setOutputFile().
● Set the audio encoder using MediaRecorder.setAudioEncoder().
● Call MediaRecorder.prepare() on the MediaRecorder instance.
● To start audio capture, call MediaRecorder.start().
● To stop audio capture, call MediaRecorder.stop().
● When you are done with the MediaRecorder instance, call
MediaRecorder.release() on it. Calling MediaRecorder.release() is always
recommended to free the resource immediately.
34
From developer.android.com - ASL
35
5. Kernel drivers
● Possibly V4Linux
● Possibly ALSA
● ... whatever hides in multimedia HAL modules
36
6. HAL Definition
● /hardware/libhardware/include/hardware/:
● audio_effect.h
● audio.h
● audio_policy.h
● camera.h
● camera2.h
● camera3.h
● camera_common.h
37
7. HAL module
● Audio skeletons in /hardware/libhardware/modules/audio
● USB audio in /hardware/libhardware/modules/usbaudio
● Default implementation in /hardware/libhardware/modules/camera
● /system/lib/hw/:
● audio.a2dp.default.so
● audio_policy.default.so
● audio_policy.mpq8064.so
● audio_policy.msm8960.so
● audio.primary.default.so
● audio.primary.mpq8064.so
● audio.primary.msm8960.so
● audio.usb.default.so
● camera.msm8960.so
38
8. System Services
● Player
● Audio Flinger
● Audio Policy
● Camera
39
8.1. Player
● Actual server:
● frameworks/av/media/libmediaplayerservice
● Client side:
● frameworks/av/media/libmedia
● Client / Server interface:
● IMediaPlayerClient.cpp
● IMediaPlayer.cpp
● IMediaPlayerService.cpp
● IMediaRecorderClient.cpp
● IMediaRecorder.cpp
40
8.2. Audio Flinger
● Actual Server:
● frameworks/av/services/audioflinger
● Client side:
● frameworks/av/media/libmedia
● Client / Server interface:
● IAudioFlingerClient.cpp
● IAudioFlinger.cpp
● IAudioRecord.cpp
● iAudioTrack.cpp
41
8.3. Audio Policy
● Actual Server:
● frameworks/av/services/audioflinger
● Client side:
● frameworks/av/media/libmedia
● Client / Server interface:
● IAudioPolicyService.cpp
42
8.4. Camera
●
Actual Server:
● frameworks/av/services/camera/libcameraservice
● Client Side:
● frameworks/av/camera
● Client / Server interface:
● ICameraClient.cpp
● ICamera.cpp
● ICameraRecordingProxy.cpp
● ICameraRecordingProxyListener.cpp
● ICameraService.cpp
● ICameraServiceListener.cpp
● IProCameraCallbacks.cpp
● IProCameraUser.cpp
43
8.5. Wrapper process
● All media system services run within
“mediaserver” system process.
● Started by init
● Sources:
● frameworks/av/media/mediaserver
44
9. Stagefright
● Multimedia framework
● Houses AwesomePlayer
● Location:
● frameworks/av/media/libstagefright
● Support loadable HW codecs:
● libstagefrighthw.so
45
10. Walkthrough
46
10. Relevant Apps
● Music
● MusicFX
● Gallery2
● SpeechRecorder
● VideoEditor
47
11. References and Pointers
● Google's “official” doumentation:
source.android.com/devices/media.html
source.android.com/devices/audio.html
source.android.com/devices/camera/camera.html
● “Use the source, Luke”
●
Developer doc:
● https://developer.android.com/guide/topics/media/mediaplayer.html
● https://developer.android.com/reference/android/media/MediaPlayer.html
● https://developer.android.com/guide/topics/media/audio-capture.html
● “Android Multimedia Framework”, picker - slideshare
●
“The Android media framework”, Bert Van Dam & Poornachandra Kallare, Android Builders Summit
2014
●
“Android’s Stagefright Media Player Architecture”, Ivo Krka,
http://quandarypeak.com/2013/08/androids-stagefright-media-player-architecture/
●
“Mastering the Android Media Framework”, Google I/O 2009
● https://www.khronos.org/openmax/
48
Thank you ...
karim.yaghmour@opersys.com
49
Acknowledgements:
● Some figures and snippets taken from Google's
Android documentation at
developer.android.com and source.android.com
distributed under the Apache 2.0 license and/or
CC-BY-SA 2.5.

More Related Content

What's hot

Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Opersys inc.
 
Android audio system(audioflinger)
Android audio system(audioflinger)Android audio system(audioflinger)
Android audio system(audioflinger)fefe7270
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)Nanik Tolaram
 
Android audio system(audioplicy_service)
Android audio system(audioplicy_service)Android audio system(audioplicy_service)
Android audio system(audioplicy_service)fefe7270
 
MediaPlayer Playing Flow
MediaPlayer Playing FlowMediaPlayer Playing Flow
MediaPlayer Playing FlowJavid Hsu
 
Android audio system(audiopolicy_manager)
Android audio system(audiopolicy_manager)Android audio system(audiopolicy_manager)
Android audio system(audiopolicy_manager)fefe7270
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessNanik Tolaram
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debuggingUtkarsh Mankad
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsLinaro
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Opersys inc.
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Opersys inc.
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesChris Simmonds
 
Reusing your existing software on Android
Reusing your existing software on AndroidReusing your existing software on Android
Reusing your existing software on AndroidTetsuyuki Kobayashi
 

What's hot (20)

Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
 
Android audio system(audioflinger)
Android audio system(audioflinger)Android audio system(audioflinger)
Android audio system(audioflinger)
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
 
Android audio system(audioplicy_service)
Android audio system(audioplicy_service)Android audio system(audioplicy_service)
Android audio system(audioplicy_service)
 
MediaPlayer Playing Flow
MediaPlayer Playing FlowMediaPlayer Playing Flow
MediaPlayer Playing Flow
 
Android audio system(audiopolicy_manager)
Android audio system(audiopolicy_manager)Android audio system(audiopolicy_manager)
Android audio system(audiopolicy_manager)
 
Low Level View of Android System Architecture
Low Level View of Android System ArchitectureLow Level View of Android System Architecture
Low Level View of Android System Architecture
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
Design and Concepts of Android Graphics
Design and Concepts of Android GraphicsDesign and Concepts of Android Graphics
Design and Concepts of Android Graphics
 
Binder: Android IPC
Binder: Android IPCBinder: Android IPC
Binder: Android IPC
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013
 
Webrender 1.0
Webrender 1.0Webrender 1.0
Webrender 1.0
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
 
Reusing your existing software on Android
Reusing your existing software on AndroidReusing your existing software on Android
Reusing your existing software on Android
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 

Viewers also liked

Android Audio & OpenSL
Android Audio & OpenSLAndroid Audio & OpenSL
Android Audio & OpenSLYoss Cohen
 
How security broken? - Android internals and malware infection possibilities
How security broken? - Android internals and malware infection possibilitiesHow security broken? - Android internals and malware infection possibilities
How security broken? - Android internals and malware infection possibilitiesFFRI, Inc.
 
The unconventional devices for the Android video streaming
The unconventional devices for the Android video streamingThe unconventional devices for the Android video streaming
The unconventional devices for the Android video streamingMatteo Bonifazi
 
HH QUALCOMM ‘hear’ & now qualcomm® snapdragon™ audio
HH QUALCOMM ‘hear’ & now qualcomm® snapdragon™ audioHH QUALCOMM ‘hear’ & now qualcomm® snapdragon™ audio
HH QUALCOMM ‘hear’ & now qualcomm® snapdragon™ audioSatya Harish
 
Android audio system(오디오 출력-트랙활성화)
Android audio system(오디오 출력-트랙활성화)Android audio system(오디오 출력-트랙활성화)
Android audio system(오디오 출력-트랙활성화)fefe7270
 
Android Training (Media)
Android Training (Media)Android Training (Media)
Android Training (Media)Khaled Anaqwa
 
Video Streaming: from the native Android player to uncoventional devices
Video Streaming: from the native Android player to uncoventional devicesVideo Streaming: from the native Android player to uncoventional devices
Video Streaming: from the native Android player to uncoventional devicesMatteo Bonifazi
 
Investigation report on 64 bit support in Android Open Source Project
Investigation report on 64 bit support in Android Open Source ProjectInvestigation report on 64 bit support in Android Open Source Project
Investigation report on 64 bit support in Android Open Source Projecthidenorly
 
Design Document Final for HELP application
Design Document Final for HELP applicationDesign Document Final for HELP application
Design Document Final for HELP applicationMamoon Ismail Khalid
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)DroidConTLV
 
Embedded Android Real-Time Streaming Optimization
Embedded Android Real-Time Streaming OptimizationEmbedded Android Real-Time Streaming Optimization
Embedded Android Real-Time Streaming OptimizationVIA Embedded
 
Second-Screen Support in Android 4.2
Second-Screen Support in Android 4.2Second-Screen Support in Android 4.2
Second-Screen Support in Android 4.2CommonsWare
 
Secondary Screen Support Using DisplayManager
Secondary Screen Support Using DisplayManagerSecondary Screen Support Using DisplayManager
Secondary Screen Support Using DisplayManagerCommonsWare
 
Surface flingerservice(서피스플링거서비스초기화 ics)
Surface flingerservice(서피스플링거서비스초기화 ics)Surface flingerservice(서피스플링거서비스초기화 ics)
Surface flingerservice(서피스플링거서비스초기화 ics)fefe7270
 
Android audio system(오디오 출력-트랙생성)
Android audio system(오디오 출력-트랙생성)Android audio system(오디오 출력-트랙생성)
Android audio system(오디오 출력-트랙생성)fefe7270
 

Viewers also liked (20)

Android Audio & OpenSL
Android Audio & OpenSLAndroid Audio & OpenSL
Android Audio & OpenSL
 
How security broken? - Android internals and malware infection possibilities
How security broken? - Android internals and malware infection possibilitiesHow security broken? - Android internals and malware infection possibilities
How security broken? - Android internals and malware infection possibilities
 
The unconventional devices for the Android video streaming
The unconventional devices for the Android video streamingThe unconventional devices for the Android video streaming
The unconventional devices for the Android video streaming
 
HH QUALCOMM ‘hear’ & now qualcomm® snapdragon™ audio
HH QUALCOMM ‘hear’ & now qualcomm® snapdragon™ audioHH QUALCOMM ‘hear’ & now qualcomm® snapdragon™ audio
HH QUALCOMM ‘hear’ & now qualcomm® snapdragon™ audio
 
Unit vi
Unit viUnit vi
Unit vi
 
Android audio system(오디오 출력-트랙활성화)
Android audio system(오디오 출력-트랙활성화)Android audio system(오디오 출력-트랙활성화)
Android audio system(오디오 출력-트랙활성화)
 
Android Training (Media)
Android Training (Media)Android Training (Media)
Android Training (Media)
 
Video Streaming: from the native Android player to uncoventional devices
Video Streaming: from the native Android player to uncoventional devicesVideo Streaming: from the native Android player to uncoventional devices
Video Streaming: from the native Android player to uncoventional devices
 
Android cameraoverview
Android cameraoverviewAndroid cameraoverview
Android cameraoverview
 
How to Use OpenGL/ES on Native Activity
How to Use OpenGL/ES on Native ActivityHow to Use OpenGL/ES on Native Activity
How to Use OpenGL/ES on Native Activity
 
Investigation report on 64 bit support in Android Open Source Project
Investigation report on 64 bit support in Android Open Source ProjectInvestigation report on 64 bit support in Android Open Source Project
Investigation report on 64 bit support in Android Open Source Project
 
Design Document Final for HELP application
Design Document Final for HELP applicationDesign Document Final for HELP application
Design Document Final for HELP application
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)
 
Embedded Android Real-Time Streaming Optimization
Embedded Android Real-Time Streaming OptimizationEmbedded Android Real-Time Streaming Optimization
Embedded Android Real-Time Streaming Optimization
 
Second-Screen Support in Android 4.2
Second-Screen Support in Android 4.2Second-Screen Support in Android 4.2
Second-Screen Support in Android 4.2
 
Logging system of Android
Logging system of AndroidLogging system of Android
Logging system of Android
 
Secondary Screen Support Using DisplayManager
Secondary Screen Support Using DisplayManagerSecondary Screen Support Using DisplayManager
Secondary Screen Support Using DisplayManager
 
Surface flingerservice(서피스플링거서비스초기화 ics)
Surface flingerservice(서피스플링거서비스초기화 ics)Surface flingerservice(서피스플링거서비스초기화 ics)
Surface flingerservice(서피스플링거서비스초기화 ics)
 
IOMX in Android
IOMX in AndroidIOMX in Android
IOMX in Android
 
Android audio system(오디오 출력-트랙생성)
Android audio system(오디오 출력-트랙생성)Android audio system(오디오 출력-트랙생성)
Android audio system(오디오 출력-트랙생성)
 

Similar to Android's Multimedia Framework

Inside Android's UI at AnDevCon IV
Inside Android's UI at AnDevCon IVInside Android's UI at AnDevCon IV
Inside Android's UI at AnDevCon IVOpersys inc.
 
Inside Android's UI at AnDevCon VI
Inside Android's UI at AnDevCon VIInside Android's UI at AnDevCon VI
Inside Android's UI at AnDevCon VIOpersys inc.
 
Inside Android's UI at AnDevCon V
Inside Android's UI at AnDevCon VInside Android's UI at AnDevCon V
Inside Android's UI at AnDevCon VOpersys inc.
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UIOpersys inc.
 
Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013Opersys inc.
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALOpersys inc.
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UIOpersys inc.
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UIOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentKarim Yaghmour
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UIOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Security Issues in Android Custom ROM
Security Issues in Android Custom ROMSecurity Issues in Android Custom ROM
Security Issues in Android Custom ROMAnant Shrivastava
 
Embedded Android Workshop part I ESC SV 2012
Embedded Android Workshop part I ESC SV 2012Embedded Android Workshop part I ESC SV 2012
Embedded Android Workshop part I ESC SV 2012Opersys inc.
 

Similar to Android's Multimedia Framework (20)

Inside Android's UI at AnDevCon IV
Inside Android's UI at AnDevCon IVInside Android's UI at AnDevCon IV
Inside Android's UI at AnDevCon IV
 
Inside Android's UI at AnDevCon VI
Inside Android's UI at AnDevCon VIInside Android's UI at AnDevCon VI
Inside Android's UI at AnDevCon VI
 
Inside Android's UI at AnDevCon V
Inside Android's UI at AnDevCon VInside Android's UI at AnDevCon V
Inside Android's UI at AnDevCon V
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UI
 
Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UI
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UI
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UI
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Security Issues in Android Custom ROM
Security Issues in Android Custom ROMSecurity Issues in Android Custom ROM
Security Issues in Android Custom ROM
 
Security Issues in Android Custom Rom
Security Issues in Android Custom RomSecurity Issues in Android Custom Rom
Security Issues in Android Custom Rom
 
Embedded Android Workshop part I ESC SV 2012
Embedded Android Workshop part I ESC SV 2012Embedded Android Workshop part I ESC SV 2012
Embedded Android Workshop part I ESC SV 2012
 

More from Opersys inc.

Android Automotive
Android AutomotiveAndroid Automotive
Android AutomotiveOpersys inc.
 
Android 10 Internals Update
Android 10 Internals UpdateAndroid 10 Internals Update
Android 10 Internals UpdateOpersys inc.
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security InternalsOpersys inc.
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with PieOpersys inc.
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Opersys inc.
 
Embedded Android Workshop with Oreo
Embedded Android Workshop with OreoEmbedded Android Workshop with Oreo
Embedded Android Workshop with OreoOpersys inc.
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in AndroidOpersys inc.
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things InternalsOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys inc.
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys inc.
 
Android Things: Android for IoT
Android Things: Android for IoTAndroid Things: Android for IoT
Android Things: Android for IoTOpersys inc.
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things InternalsOpersys inc.
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in AndroidOpersys inc.
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave InternalsOpersys inc.
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in AndroidOpersys inc.
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys inc.
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave InternalsOpersys inc.
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in AndroidOpersys inc.
 

More from Opersys inc. (20)

Android Automotive
Android AutomotiveAndroid Automotive
Android Automotive
 
Android 10 Internals Update
Android 10 Internals UpdateAndroid 10 Internals Update
Android 10 Internals Update
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security Internals
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with Pie
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?
 
Embedded Android Workshop with Oreo
Embedded Android Workshop with OreoEmbedded Android Workshop with Oreo
Embedded Android Workshop with Oreo
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in Android
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things Internals
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Android Things: Android for IoT
Android Things: Android for IoTAndroid Things: Android for IoT
Android Things: Android for IoT
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things Internals
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in Android
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave Internals
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in Android
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave Internals
 
Project Ara
Project AraProject Ara
Project Ara
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in Android
 

Recently uploaded

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 

Recently uploaded (20)

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 

Android's Multimedia Framework

  • 1. 1 Android's Multimedia Framework September 2014 Karim Yaghmour @karimyaghmour karim.yaghmour@opersys.com
  • 2. 2 These slides are made available to you under a Creative Commons Share- Alike 3.0 license. The full terms of this license are here: https://creativecommons.org/licenses/by-sa/3.0/ Attribution requirements and misc., PLEASE READ: ● This slide must remain as-is in this specific location (slide #2), everything else you are free to change; including the logo :-) ● Use of figures in other documents must feature the below “Originals at” URL immediately under that figure and the below copyright notice where appropriate. ● You are free to fill in the “Delivered and/or customized by” space on the right as you see fit. ● You are FORBIDEN from using the default “About” slide as-is or any of its contents. ● You are FORBIDEN from using any content provided by 3rd parties without the EXPLICIT consent from those parties. (C) Copyright 2013-2014, Opersys inc. These slides created by: Karim Yaghmour Originals at: www.opersys.com/community/docs Delivered and/or customized by
  • 3. 3 About ● Author of: ● Introduced Linux Trace Toolkit in 1999 ● Originated Adeos and relayfs (kernel/relay.c) ● Training, Custom Dev, Consulting, ...
  • 4. 4 Agenda ● Architecture Basics ● Display Core ● Multimedia Architecture ● App Dev Model ● Kernel Drivers ● HAL definitions ● HAL modules ● System Services ● Stagefright ● Walkthrough ● Relevant Apps ● References and Pointers
  • 5. 5 1. Architecture Basics ● Hardware used to run Android ● AOSP ● Binder ● System Services ● HAL
  • 6. 6
  • 7. 7
  • 8. 8
  • 9. 9
  • 10. 10
  • 12. 12 2. Display Core ● Display Hardware ● Display stack in Android ● Kernel driver ● HAL definition ● HAL module ● Surface Flinger ● Window Manager
  • 14. 14 2.2. Display stack in Android
  • 15. 15
  • 18. 18 2.3. Kernel driver ● Video memory management ● Mode setting ● Checking of parameters ● Motorola Xoom: ● /dev/nvhdcp1 ● /dev/nvhost-ctrl ● /dev/nvhost-display ● /dev/nvhost-dsi ● /dev/nvhost-gr2d ● /dev/nvhost-gr3d ● /dev/nvhost-isp ● /dev/nvhost-mpe ● /dev/nvhost-vi ● /dev/nvmap ● /dev/tegra-crypto ● /dev/tegra_avp ● /dev/tegra_camera ● /dev/tegra_fuse ● /dev/tegra_rpc ● /dev/tegra_sema ● ... whatever hides in hwcomposer HAL module
  • 19. 19 2.3. HAL Definition ● /hardware/libhardware/include/hardware/hwcomposer.h ● struct hwc_procs: ● invalidate() ● vsync() ● struct hwc_composer_device: ● prepare() ● set() ● dump() ● registerProcs() ● query() ● *()
  • 20. 20 2.5. HAL module ● Skeleton /hardware/libhardware/modules/hwcomposer.cpp ● /system/lib/hw/hwcomposer.BOARD.so ● /system/lib/hw/gralloc.BOARD.so ● Ex. - Mot Xoom: ● hwcomposer.tegra.so ● gralloc.tegra.so ● Surface Flinger hook: ● /frameworks/native/services/surfaceflinger/DisplayHardware – HWComposer.cpp – Provides fake vsync if none is provided in HW
  • 21. 21 2.6. Surface Flinger ● Actual server: ● /frameworks/native/services/surfaceflinger ● Client side: ● /frameworks/native/libs/gui ● Client / Server interface: ● ISurfaceComposerClient.cpp ● ISurfaceComposer.cpp ● This is NOT an aidl'ed service ● All communication is manually marshalled/unmarshalled
  • 22. 22 2.7. Window Manager ● Server side: ● /frameworks/base/services/java/com/android/server/wm/ – WindowManagerService.java – Session.java ● Client side: ● /frameworks/base/core/java/android/view/ – WindowManager.java – WindowManagerImpl.java – ViewRootImpl.java ● Interfaces: ● IWindowManager.aidl ● IWindowSession.aidl ● Parameters (incl. z-order): ● See WindowManager.java
  • 23. 23 3. Multimedia Architecture ● OpenMAX ● Media Playback ● Audio ● Camera
  • 25. 25 3.2. Media Playback From source.android.com - CC-BY 2.5
  • 30. 30 4. App Dev Model ● Media Playback ● Audio Record ● Camera
  • 31. 31 4.1. Media Playback ● developer.android.com sample: Uri myUri = ....; // initialize Uri here MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.setDataSource(getApplicationContext(), myUri); mediaPlayer.prepare(); mediaPlayer.start();
  • 33. 33 4.2. Audio Record ● developer.android.com steps: ● Create a new instance of android.media.MediaRecorder. ● Set the audio source using MediaRecorder.setAudioSource(). You will probably want to use MediaRecorder.AudioSource.MIC. ● Set output file format using MediaRecorder.setOutputFormat(). ● Set output file name using MediaRecorder.setOutputFile(). ● Set the audio encoder using MediaRecorder.setAudioEncoder(). ● Call MediaRecorder.prepare() on the MediaRecorder instance. ● To start audio capture, call MediaRecorder.start(). ● To stop audio capture, call MediaRecorder.stop(). ● When you are done with the MediaRecorder instance, call MediaRecorder.release() on it. Calling MediaRecorder.release() is always recommended to free the resource immediately.
  • 35. 35 5. Kernel drivers ● Possibly V4Linux ● Possibly ALSA ● ... whatever hides in multimedia HAL modules
  • 36. 36 6. HAL Definition ● /hardware/libhardware/include/hardware/: ● audio_effect.h ● audio.h ● audio_policy.h ● camera.h ● camera2.h ● camera3.h ● camera_common.h
  • 37. 37 7. HAL module ● Audio skeletons in /hardware/libhardware/modules/audio ● USB audio in /hardware/libhardware/modules/usbaudio ● Default implementation in /hardware/libhardware/modules/camera ● /system/lib/hw/: ● audio.a2dp.default.so ● audio_policy.default.so ● audio_policy.mpq8064.so ● audio_policy.msm8960.so ● audio.primary.default.so ● audio.primary.mpq8064.so ● audio.primary.msm8960.so ● audio.usb.default.so ● camera.msm8960.so
  • 38. 38 8. System Services ● Player ● Audio Flinger ● Audio Policy ● Camera
  • 39. 39 8.1. Player ● Actual server: ● frameworks/av/media/libmediaplayerservice ● Client side: ● frameworks/av/media/libmedia ● Client / Server interface: ● IMediaPlayerClient.cpp ● IMediaPlayer.cpp ● IMediaPlayerService.cpp ● IMediaRecorderClient.cpp ● IMediaRecorder.cpp
  • 40. 40 8.2. Audio Flinger ● Actual Server: ● frameworks/av/services/audioflinger ● Client side: ● frameworks/av/media/libmedia ● Client / Server interface: ● IAudioFlingerClient.cpp ● IAudioFlinger.cpp ● IAudioRecord.cpp ● iAudioTrack.cpp
  • 41. 41 8.3. Audio Policy ● Actual Server: ● frameworks/av/services/audioflinger ● Client side: ● frameworks/av/media/libmedia ● Client / Server interface: ● IAudioPolicyService.cpp
  • 42. 42 8.4. Camera ● Actual Server: ● frameworks/av/services/camera/libcameraservice ● Client Side: ● frameworks/av/camera ● Client / Server interface: ● ICameraClient.cpp ● ICamera.cpp ● ICameraRecordingProxy.cpp ● ICameraRecordingProxyListener.cpp ● ICameraService.cpp ● ICameraServiceListener.cpp ● IProCameraCallbacks.cpp ● IProCameraUser.cpp
  • 43. 43 8.5. Wrapper process ● All media system services run within “mediaserver” system process. ● Started by init ● Sources: ● frameworks/av/media/mediaserver
  • 44. 44 9. Stagefright ● Multimedia framework ● Houses AwesomePlayer ● Location: ● frameworks/av/media/libstagefright ● Support loadable HW codecs: ● libstagefrighthw.so
  • 46. 46 10. Relevant Apps ● Music ● MusicFX ● Gallery2 ● SpeechRecorder ● VideoEditor
  • 47. 47 11. References and Pointers ● Google's “official” doumentation: source.android.com/devices/media.html source.android.com/devices/audio.html source.android.com/devices/camera/camera.html ● “Use the source, Luke” ● Developer doc: ● https://developer.android.com/guide/topics/media/mediaplayer.html ● https://developer.android.com/reference/android/media/MediaPlayer.html ● https://developer.android.com/guide/topics/media/audio-capture.html ● “Android Multimedia Framework”, picker - slideshare ● “The Android media framework”, Bert Van Dam & Poornachandra Kallare, Android Builders Summit 2014 ● “Android’s Stagefright Media Player Architecture”, Ivo Krka, http://quandarypeak.com/2013/08/androids-stagefright-media-player-architecture/ ● “Mastering the Android Media Framework”, Google I/O 2009 ● https://www.khronos.org/openmax/
  • 49. 49 Acknowledgements: ● Some figures and snippets taken from Google's Android documentation at developer.android.com and source.android.com distributed under the Apache 2.0 license and/or CC-BY-SA 2.5.