Android SurfaceView: can be used for media or direct access, but not for both.

That is, if you have an instance of SurfaceView, you can use it for video/camera, or use it for direct access as a buffer, but you cannot reuse it for media after you already accessed it through either ANativeWindow API or any other internal ways. The reason is in ASOP code Surface.cpp. Surface connected to…

So many traps there…

Simply, a .so compiled by android ndk r9 gcc 4.6 crashed on loading in function __check_for_sync8_kernelhelper. After looking up the issue in Google, I found this issue has been reported to Google: https://code.google.com/p/android/issues/detail?id=58476. Unfortunately no solution at present. Basically it is an libgcc issue depending on linux kernel version. Lower kernel version lacks the symbol that…

Why so many latencies in BB10 audio playback? Why we always get underrun in audio data feeds?

They are two faces of one same issue. If you started coding audio playback from reading PlayWav sample in BlackBerry’s github repository, you will find there are long latencies in audio playback, that is, about 5s after you fed data, you can hear the sound. But why? BB10 uses ALSA’s libasound as its audio API…

iOS7: We cannot modify UIAlertView directly now.

From iPhoneOS 1 to 6, each experienced iOS programmer knows how to modify UIAlertView for appearance customization. For example, to add some UI elements like UILabel or a secure UITextField for password input, etc. One of our little tool keyOne used this trick. But this doesn’t work in recent iOS7 beta. The reason is simple…

Updated gas-preprocessor to handle clang’s issue related to -g option

clang included in Xcode 4.3.x (LLVM 3.1) has an odd issue when it is used with gas-preprocessor. As you may know, gas-preprocessor adds “-S” to compiler’s command line to generate assembler source, does some preprocessing on it, then invokes compiler again. The compiler then invokes assembler to create final objective code. Here, compiler is clang…

用 Instruments 来分析 iPhone 应用程序

注意哦, 这里说的不是你自己的应用, 那个太简单容易了, 没什么挑战, 不值得在这里写一篇 blog. 目标: 用 Instruments 来 profiling 第三方的应用, 没有源码的, 只有 binary 的. Apple 在系统中对 Instruments 运行有一个限制: 在碰到使用 distributed certificate 做 codesign 的 app, 不予运行, 直接 kill 9. 所以, 我们需要有一个可用的 developer certificate. 然后就很简单了. codesign -fs “iPhone Developer: Holly Lee” –resource-ruls ResourceRules.plist –entitlements Entitlements.xml AppBinary 好了之后放入 iPhone 里覆盖原来的 binary, 然后运行 Instruments 选择该 app…

Objective-C(++) 的一些细节注意点

如果把 objc 类放到一个库中, 然后在主程序里并不直接引用到类本身的构造, 而是通过诸如 .xib 中命名或者类似的  serialization 方式使用这个类的话, 需要在 Linker flags 中加入 -ObjC, 否则该类不会被正确构造. 一个例子是将一个 customized view 放到 .a 中, 然后在 xib 中将一个 view 的 class 设为此 custom view, 在主程序中 load 之后, 会发现其实只产生了一个 UIView 而未产生正确的 CustomView. 解决方法就是将 -ObjC 加入到 linker flag. 如果还不行的话, 还有最后一招 -all_load. 这个 linker flag 的意思是不管三七二十一, 把所有东西都连到最后的 binary 里. 作为 Objc 类的成员定义的…