android (16)

来源:互联网 发布:c语言不等于符号 编辑:程序博客网 时间:2024/05/18 02:17

 


 android (16)
 
 编码质量对比
 
 实际带宽
 
  class Thread : virtual public RefBase
 
  static pthread_key_t gTLS = 0;

  static pthread_key_t gTLS = 0;
 
  生成了一个pthread_getspecific
 
  int androidSetThreadSchedulingGroup(pid_t tid, int grp)
{
    if (grp > ANDROID_TGROUP_MAX || grp < 0) {
        return BAD_VALUE;
    }
#if defined(HAVE_PTHREADS)
    pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup);
    if (gDoSchedulingGroup) {
        if (set_sched_policy(tid, (grp == ANDROID_TGROUP_BG_NONINTERACT) ?
                                          SP_BACKGROUND : SP_FOREGROUND)) {
            return PERMISSION_DENIED;
        }
    }
#endif
   
    return NO_ERROR;
}

继续媒体框架

sp<IMediaPlayer> MediaPlayerService::create(pid_t pid, const sp<IMediaPlayerClient>& client,
        int fd, int64_t offset, int64_t length, int audioSessionId)
{
    int32_t connId = android_atomic_inc(&mNextConnId);
    sp<Client> c = new Client(this, pid, connId, client, audioSessionId);
    LOGV("Create new client(%d) from pid %d, fd=%d, offset=%lld, length=%lld, audioSessionId=%d",
            connId, pid, fd, offset, length, audioSessionId);
    if (NO_ERROR != c->setDataSource(fd, offset, length)) {
        c.clear();
    } else {
        wp<Client> w = c;
        Mutex::Autolock lock(mLock);
        mClients.add(w);
    }
    ::close(fd);
    return c;
}

create 是被谁调用的?

这个是在哪边?

服务端肯定要有

void MediaPlayerService::instantiate() {
    defaultServiceManager()->addService(
            String16("media.player"), new MediaPlayerService());
}

这样就添加了一个服务

怎么从binder 那边调过来?

defaultServiceManager 返回了一个binder接口

binder的服务端在哪?

不是2方,现在有3方

重新编译后 只刷system看一下

libmedia 和 libmediaservice 通过binder通讯的?

怎么进行单独编译?

Android比较重要的三个img文件:

make systemimage    - system.img
make userdataimage  - userdata.img
make ramdisk         - ramdisk.img

PS:make snod - 快速打包system.img
PS2: 改写system - mount -t yaffs2 -o remount,rw /dev/block/mtdblock0 /system

android中的一个应用程序可以单独编译,编译后要重新生成system.img
在源码目录下执行
. build/envsetup.sh (.后面有空格)
就多出一些命令:
- croot:   Changes directory to the top of the tree.
- m:       Makes from the top of the tree.
- mm:      Builds all of the modules in the current directory.
- mmm:     Builds all of the modules in the supplied directories.
- cgrep:   Greps on all local C/C++ files.
- jgrep:   Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.
- godir:   Go to the directory containing a file.
可以加—help查看用法
我们可以使用mmm来编译指定目录的模块,如编译联系人:
mmm packages/apps/Contacts/
编完之后生成两个文件:
out/target/product/generic/data/app/ContactsTests.apk
out/target/product/generic/system/app/ Contacts.apk
可以使用make snod重新生成system.img
再运行模拟器

将busybox 考进去了

 printf("fine %s  fun %s  line %d \n",__FILE__,__FUNCTION__ ,__LINE__);
 
stagefraight中有VPUEncoder

 
 VPUEncoder 的构造是什么时候
 
 OMXCodec::Create
 
 OMXMaster 插件 组件管理
 
 插件管理
 看一下编码类
 
 跑在一个虚拟机进程里的 
 
 
On an Android device, the Dalvik virtual machine usually executes embedded in the Android application framework.

 It's also possible to run it directly, just as you would a virtual machine on your desktop system
     
 After compiling your Java language sources, convert and combine the .class files into a DEX file,
 
 and push that to the device. Here's a simple example:

% echo 'class Foo {'\
> 'public static void main(String[] args) {'\
> 'System.out.println("Hello, world"); }}' > Foo.java
% javac Foo.java
% dx --dex --output=foo.jar Foo.class
% adb push foo.jar /sdcard
% adb shell dalvikvm -cp /sdcard/foo.jar Foo
Hello, world

 The -cp option sets the classpath. The initial directory for adb shell may not be what you expect it to be,
 
 so it's usually best to specify absolute pathnames.

The dx command accepts lists of individual class files, directories, or Jar archives. When the --output filename ends

 with .jar, .zip, or .apk, a file called classes.dex is created and stored inside the archive.

Run adb shell dalvikvm -help to see a list of command-line options.

Using a debugger
You can debug stand-alone applications with any JDWP-compliant debugger. There are two basic approaches.

The first way is to connect directly through TCP. Add, to the "dalvikvm" invocation line above, an argument like:

  -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y

This tells the VM to wait for a debugger to connect to it on TCP port 8000. You need to tell adb to forward local port 8000 to device port 8000:

% adb forward tcp:8000 tcp:8000

and then connect to it with your favorite debugger (using jdb as an example here):

% jdb -attach localhost:8000

When the debugger attaches, the VM will be in a suspended state. You can set breakpoints and then tell it to continue.


You can also connect through DDMS, like you would for an Android application. Add, to the "dalvikvm" command line:

  -agentlib:jdwp=transport=dt_android_adb,suspend=y,server=y

Note the transport has changed, and you no longer need to specify a TCP port number. When your application starts, it will appear in DDMS,

with "?" as the application name. Select it in DDMS, and connect to it as usual, e.g.:

% jdb -attach localhost:8700

Because command-line applications don't include the client-side DDM setup, features like thread monitoring and allocation tracking will not be available in DDMS.

 It's strictly a debugger pass-through in this mode.

See Dalvik Debugger Support for more information about using debuggers with Dalvik.

原创粉丝点击