Android MusicPlayer uses Stagefright or opencore

1.1k views Asked by At

I read that if media.stagefright.enable-player is set true then the device uses Stagefright. In my device's build.prop i see

media.stagefright.enable-player = false

When i tired below

MediaPlayer mp = new MediaPlayer();
mp.setDataSource(String.format("http://127.0.0.1:%d/", socketPort));
mp.prepare();
mp.start();

I hosted a server socket to which the mediaplayer connects

ServerSocket serverSocket = null;
        try {
            serverSocket = new ServerSocket(0);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
         socketPort = serverSocket.getLocalPort();

        Socket socket = null;
        try {
            socket = serverSocket.accept();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        InputStream is = null;
        try {
            is = socket.getInputStream();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        byte [] temp = new byte [1024];     
        int bsize = -1;
        while(bsize <= 0) {
            try {
                bsize = is.read(temp);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
        final String readData = new String(temp);
        Log.e("readDta",readData);

The log i get is

11-22 15:06:56.656: E/readDta(8737): GET / HTTP/1.111-22 15:06:56.656: E/readDta(8737): Host: 127.0.0.111-22 15:06:56.656: E/readDta(8737): User-Agent: stagefright/1.1 (Linux;Android 2.3.6)

Now my doubt is,, how it shows me User-Agent: stagefright/1.1 though it's set media.stagefright.enable-player = false in build.prop ?

If it's not a way to determine which is used, how can i detect whether opencore or stagefright ?

2

There are 2 answers

0
Ganesh On BEST ANSWER

From your logs, I feel that the version of Android is Froyo 2.2.3 which is the probably one of the last versions before Stagefright became a default. The choice of player is dependent on multiple conditions like whether it is a file source or http source or rtsp source.

In Froyo 2.2.3, there are 2 keys for enabling Stagefright player and a build flag. To enable the use of Stagefright player for normal playback, you need to build the framework code with BUILD_WITH_FULL_STAGEFRIGHT as observed from here: http://androidxref.com/2.2.3/xref/frameworks/base/media/libmediaplayerservice/MediaPlayerService.cpp#670

getDefaultPlayer is called for multiple conditions and in cases where the aforementioned macro is defined, it would try to check the value of the system property "media.stagefright.enable-player" (Ref: http://androidxref.com/2.2.3/xref/frameworks/base/media/libmediaplayerservice/MediaPlayerService.cpp#750)

In your case for http source, there is a different system property which is checked viz., "media.stagefright.enable-http". In your case, I feel that this is enabled/set to true and hence, Stagefright player is being employed. Please set this to false to enable PV_Player only.

3
Ryszard Grzesica On

IMHO this is an ancient prop from GB, what Android are you using? I did not see this in the usage in the code even in GB... What I can imagine is that "media.stagefright.enable-player false/true" means that stagefright player is/is not used what does not mean that libstagefrigt.so (framework which uses Open MAX) is or is not used. When I was working with GB libstagefright, so Open MAX was in use always (only some codecs in GB were not ported to OMX).