Friday, July 27, 2012

Dalvik Debug Monitoring System:



DDMS is integrated into Eclipse and is also shipped in the tools/ directory of the SDK. DDMS works with both the emulator and a connected device. If both are connected and running simultaneously, DDMS defaults to the emulator.
  • From Eclipse: Click Window > Open Perspective > Other... > DDMS.
  • From the command line: Type ddms (or ./ddms on Mac/Linux) from thetools/ directory

    How DDMS Interacts with a Debugger

    When DDMS starts, it connects to adb. When a device is connected, a VM monitoring service is created between adb and DDMS, which notifies DDMS when a VM on the device is started or terminated. Once a VM is running, DDMS retrieves the the VM's process ID (pid), via adb, and opens a connection to the VM's debugger, through the adb daemon (adbd) on the device. DDMS can now talk to the VM using a custom wire protocol

    DDMS features summary:/when we will use DDMS ?
    For the following purpose, we can use DDMS.
    1.Viewing heap usage for a process
    2.Tracking memory allocation of objects
    3.Working with emulator or device's file system 
        we can copy video files/files to emulator or device with DDMS
    4.using logcat : logs can be viewed and filtered based on LOG_TAGS
    5.monitoring network traffic information






Changes/Features in android  Icecream sandwich:

1.RTSP streaming was integrated with NuPlayer
2.Valgrind  static memory leak tool is ported to android
3.gdb is ported to android
4.OpenCV image processing library is ported to android that is why facedetection / recognition is possible in
ICS . Samsung S III ICS is having face detection functionality
5.OpenAL application layer support  [refer system/media/wilhelm folder path]
6.Subtitle support through TimedTextPlayer for video/audio playback
7.ION memmory manager support in ICS
[ ION is a generalized memory manager that Google introduced in the Android 4.0 ICS (Ice Cream Sandwich) release to address the issue of fragmented memory management interfaces across different Android devices. There are at least three, probably more, PMEM-like interfaces. On Android devices using NVIDIA Tegra, there is "NVMAP"; on Android devices using TI OMAP, there is "CMEM"; and on Android devices using Qualcomm MSM, there is "PMEM" . All three SoC vendors are in the process of switching to ION].
More about ION memory can be found : http://lwn.net/Articles/480055/
8.Framework for DRM
9.NuPlayer is introduced for HTTP live streaming in Honeycomb tablet. In ICS,  RTSP stack/streaming is removed from stagefright and integrated into NuPlayer
10. There are two ways to integrate the decoders in gingerbread
        i) Software decoder path [google decoders are integrated by deriving from MediaSource.InstantiateSoftwareDecoder() function is used within OMXCodec.
        ii) OMX path
       
  From ICS onwards, Google decoders are integrated in OMX Path and InstantiateSoftwareDecoder() is removed in stagefright




How will you identify the memory leaks in android ?
1.We can use valgrind tool to find memory leaks, stack corruption, array bound overflows etc
2 Valgrind tool is ported in Icecream sandwich onwards
3.From DDMS, we can select the process and start profiling, we have to do suspected memory leak operation,some file will be created.we can use eclipse memory analyzer tool to identify the memory leaks from this file
4.We can identify the memory leak by process. By putting ps command it will list down the memory occupied by process. Same can be viewed in settings option also. 


      If we want to check whether the video playback has memory leak or not,we have to type ps command to identify the memory occupied by mediaserver process. we can run the video continuously for 100 times or 200 times. Afterwards we have to check memory again for mediaserver process in ps command. if there is a great increase in memory, then we can confirm there is a memoryleak in a video playback. 


What is missing in Android Stagefright/NuPlayer RTSP streaming ?

1.Jitter buffer handling
2.RTCP handling
3.Error correction and feedback through RTCP Sender report/receiver report

What are all the buffering mechanism available in OMX ?
   1.AllocateBuffer - Allocates buffer
   2.UseBuffer - use the buffer given by the downstream component. Example using the video renderer's memory to fill the decoded data

When the input buffer or output buffer of the component should be released?
        Once the OMX input buffer is used and ready to release,  it will return the EMPTY_BUFFER_DONE event to the stagefright or who is owning the buffer. Once the IL client received the EMPTY_BUFFER_DONE event, it can release the input buffer.
     OMX  IL client will receives the FILL_BUFFER_DONE event from OMX component once the output buffer is used and ready to release. Once IL client received the FILL_BUFFER_DONE event, IL client will frees the output buffer.

How Seek operation is executed in Stagefright ?
        Once the application is giving seek, Thru stagefright player, awesome player calls the seek() function.

How seek operation is notified to the parser or Extractor ?
     within Awesomeplayer, SeekTo() fn is called, it will sets the ReadOptions structure values as seek mode set and seek timestamp is also stored in this structure.

     Awesomeplayer while calling decoder, it will  invoke decoder as below

            mVideoSource->read(&decodedBuffer, &readOptions);

This readoptions value is passed to decoder and decoder will have the pointer to the MPEG4/MKV extractor's media source.
       Decoder will invoke read() fn of the audio/video source of the extractor by passing readOptions.

within parser's media source ->read() fn, it will checks whether the seek mode is set or not. if it is set, it will
do seek to seektimestamp through parser.


                 

         

 

     

Wednesday, July 25, 2012

what is OMX Content Pipe  ?

From OMX IL 1.1 standard, we can integrate source[3GP parsers] or Streaming source /sink [MP4 muxer].

Through content pipe, it is possible for us to integrate the source/sink components.

Content Pipe specification explains on how it open/read/write positions from storage/ from network.