Hi,
While playing video clips with Android 4.0.3 on Beagleboard, we
observed that video clips with resolution 720x480 are not getting
played.
After debugging this issue we found that clips with WIDTH/2 is not
multiple of 16 (i.e. not aligned to 16) results in crash as the
renderer code expect that the destination buffer to be aligned to 16.
But the allocated destination buffer is not aligned. So while memcpy
the renderer mis-calculates the dest_u pointer and crashes.
We have created following patch to fix this issue.
Patch: <frameworks/base repository>
-------------------------------------------------------------
diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp
b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
index ac5c6dc..49d33c9 100644
--- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp
+++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
@@ -206,7 +206,7 @@ void SoftwareRenderer::render(
uint8_t *dst_y = (uint8_t *)dst;
size_t dst_y_size = buf->stride * buf->height;
- size_t dst_c_stride = ALIGN(buf->stride / 2, 16);
+ size_t dst_c_stride = buf->stride / 2;
size_t dst_c_size = dst_c_stride * buf->height / 2;
uint8_t *dst_v = dst_y + dst_y_size;
uint8_t *dst_u = dst_v + dst_c_size;
-------------------------------------------------------------
Is this the correct place to fix this issue or it can be fixed at
other appropriate place?
Please provide your expert view on this.
Crash log while playing 720x480 clip:
I/ActivityManager( 1253): START {act=android.intent.action.VIEW
dat=content://media/external/video/media/49 typ=video/* cmp=c
om.android.gallery3d/.app.MovieActivity (has extras)} from pid 1684
I/AudioService( 1253): AudioFocus requestAudioFocus() from
android.media.AudioManager@4114c588
I/OMXCodec( 1881): [OMX.google.h264.decoder] AVC profile = 66
(Baseline), level = 31
I/OMXCodec( 1881): [OMX.google.h264.decoder] video dimensions are 320
x 240
I/OMXCodec( 1881): [OMX.google.h264.decoder] Crop rect is 320 x 240 @
(0, 0)
I/ActivityManager( 1253): Displayed
com.android.gallery3d/.app.MovieActivity: +283ms
D/MediaPlayer( 1684): getMetadata
I/OMXCodec( 1881): [OMX.google.h264.decoder] video dimensions are 720
x 480
I/OMXCodec( 1881): [OMX.google.h264.decoder] Crop rect is 720 x 480 @
(0, 0)
F/libc ( 1881): Fatal signal 11 (SIGSEGV) at 0x41d3a000 (code=1)
E/audio_hw_primary( 1881): Route MIXER CTRL name: HeadsetR Mixer
AudioR2
E/audio_hw_primary( 1881): Route MIXER CTRL name: HeadsetL Mixer
AudioL2
E/audio_hw_primary( 1881): Route MIXER CTRL name: Headset Playback
Volume
E/audio_hw_primary( 1881): Route MIXER CTRL name: Analog Left AUXL
Capture Switch
V/StateManager( 1684): saveState
V/StateManager( 1684): saveState class
com.android.gallery3d.app.AlbumSetPage
V/StateManager( 1684): saveState class
com.android.gallery3d.app.AlbumPage
V/StateManager( 1684): saveState class
com.android.gallery3d.app.PhotoPage
I/DEBUG ( 1146): *** *** *** *** *** *** *** *** *** *** *** *** ***
*** *** ***
I/DEBUG ( 1146): Build fingerprint: 'Android/omap3evm/omap3evm:4.0.3/
IML74K/eng.x0179559.20120321.144354:eng/test-keys'
I/DEBUG ( 1146): pid: 1881, tid: 1995 >>> /system/bin/mediaserver
<<<
I/DEBUG ( 1146): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault
addr 41d3a000
I/DEBUG ( 1146): r0 41d3a000 r1 41f0afd0 r2 00000068 r3 00000000
I/DEBUG ( 1146): r4 000280b0 r5 0001c5f8 r6 41f0af10 r7 000151d0
I/DEBUG ( 1146): r8 000000eb r9 41d24660 10 41f20090 fp 00000170
I/DEBUG ( 1146): ip 40bbafd4 sp 416b6d48 lr 40b12101 pc
40094b88 cpsr 20000010
I/DEBUG ( 1146): d0 8080808080808080 d1 8080808080808080
I/DEBUG ( 1146): d2 8080808080808080 d3 8080808080808080
I/DEBUG ( 1146): d4 8080808080808080 d5 8080808080808080
I/DEBUG ( 1146): d6 8080808080808080 d7 8080808080808080
I/DEBUG ( 1146): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 1146): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 1146): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 1146): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 1146): d16 3fdb390135d1ac72 d17 4001540d31d1dd7f
I/DEBUG ( 1146): d18 4000000000000000 d19 bfc540d31d1dd7f1
I/DEBUG ( 1146): d20 3f1153849946b6ba d21 bebbb89c51a06d6e
I/DEBUG ( 1146): d22 3ff0000000000000 d23 3feb390135d1ac72
I/DEBUG ( 1146): d24 3e66376972bea4d0 d25 0000000000000000
I/DEBUG ( 1146): d26 0000000000000000 d27 0000000000000000
I/DEBUG ( 1146): d28 0000000000000000 d29 0000000000000000
I/DEBUG ( 1146): d30 0000000000000000 d31 0000000000000000
I/DEBUG ( 1146): scr 60000010
I/DEBUG ( 1146):
I/DEBUG ( 1146): #00 pc 0000db88 /system/lib/libc.so
(memcpy)
I/DEBUG ( 1146): #01 pc 0007a0fe /system/lib/
libstagefright.so (_ZN7android16SoftwareRenderer6renderEPKvjPv)
I/DEBUG ( 1146):
I/DEBUG ( 1146): code around pc:
I/DEBUG ( 1146): 40094b68 f5d1f080 f5d1f0c0 f5d1f100
f421020d ..............!.
I/DEBUG ( 1146): 40094b78 f421420d f5d1f100 e2522040
f400022d .B!.....@ R.-...
I/DEBUG ( 1146): 40094b88 f400422d 2afffff8 e2822040 e2522020 -
B.....*@ .. R.
I/DEBUG ( 1146): 40094b98 3a000003 f421020d e2522020
f400022d ...:..!. R.-...
I/DEBUG ( 1146): 40094ba8 2afffffb e2822020 e3120010
0a000001 ...* ..........
I/DEBUG ( 1146):
I/DEBUG ( 1146): code around lr:
I/DEBUG ( 1146): 40b120e0 45996ae3 2700dbf0 e01846b8
f1086aa2 .j.E...'.F...j..
I/DEBUG ( 1146): 40b120f0 1c530801 71d3eb03 4631104a
effef7cc ..S....qJ.1F....
I/DEBUG ( 1146): 40b12100 46516aa2 eb001c50 464873d0
f7cc105a .jQFP....sHFZ...
I/DEBUG ( 1146): 40b12110 6921eff6 72d1eb01 18361050 6ae34482 ..!
i...rP.6..D.j
I/DEBUG ( 1146): 40b12120 1c59980e eb009a0f eb010907
19d07cd1 ..Y..........|..
I/DEBUG ( 1146):
I/DEBUG ( 1146): memory map around addr 41d3a000:
I/DEBUG ( 1146): 41cbb000-41d3a000 /dev/pvrsrvkm
I/DEBUG ( 1146): (no map for address)
I/DEBUG ( 1146): 41ea2000-41fa0000 /dev/ashmem/OMXCodec (deleted)
I/DEBUG ( 1146):
I/DEBUG ( 1146): stack:
I/DEBUG ( 1146): 416b6d08 0001a33c [heap]
I/DEBUG ( 1146): 416b6d0c 41085dd4 /system/lib/hw/
gralloc.omap3.so
I/DEBUG ( 1146): 416b6d10 000001e0
I/DEBUG ( 1146): 416b6d14 000002d0
I/DEBUG ( 1146): 416b6d18 416b6dac
I/DEBUG ( 1146): 416b6d1c 41ea2000 /dev/ashmem/OMXCodec
(deleted)
I/DEBUG ( 1146): 416b6d20 00000002
I/DEBUG ( 1146): 416b6d24 00100000
I/DEBUG ( 1146): 416b6d28 00000001
I/DEBUG ( 1146): 416b6d2c 4020e655 /system/lib/libui.so
I/DEBUG ( 1146): 416b6d30 00000000
I/DEBUG ( 1146): 416b6d34 000002d0
I/DEBUG ( 1146): 416b6d38 000001e0
I/DEBUG ( 1146): 416b6d3c 416b6dc8
I/DEBUG ( 1146): 416b6d40 df0027ad
I/DEBUG ( 1146): 416b6d44 00000000
I/DEBUG ( 1146): #00 416b6d48 41d39f60 /dev/pvrsrvkm
I/DEBUG ( 1146): 416b6d4c 40b12101 /system/lib/
libstagefright.so
I/DEBUG ( 1146): #01 416b6d50 416b6dc8
I/DEBUG ( 1146): 416b6d54 400cf474
I/DEBUG ( 1146): 416b6d58 0000003b
I/DEBUG ( 1146): 416b6d5c 400cf474
I/DEBUG ( 1146): 416b6d60 000280b0 [heap]
I/DEBUG ( 1146): 416b6d64 0040c0c8
I/DEBUG ( 1146): 416b6d68 0002a868 [heap]
I/DEBUG ( 1146): 416b6d6c 400cf474
I/DEBUG ( 1146): 416b6d70 00100000
I/DEBUG ( 1146): 416b6d74 4009b9dd /system/lib/libc.so
I/DEBUG ( 1146): 416b6d78 00000001
I/DEBUG ( 1146): 416b6d7c 40189537 /system/lib/libbinder.so
I/DEBUG ( 1146): 416b6d80 000239e0 [heap]
I/DEBUG ( 1146): 416b6d84 00023a10 [heap]
I/DEBUG ( 1146): 416b6d88 41d0f600 /dev/pvrsrvkm
I/DEBUG ( 1146): 416b6d8c 41d24f00 /dev/pvrsrvkm
I/DEBUG ( 1146): 416b6d90 00000000
I/DEBUG ( 1146): 416b6d94 00000000
W/AudioSystem( 1684): AudioFlinger server died!
W/IMediaDeathNotifier( 1684): media server died
E/MediaPlayer( 1684): error (100, 0)
Thanks and Regards,
Pankaj Bharadiya
arowboat.org
--
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting