Monday, January 11, 2016

Neighborhoods, can directly call the android libmedia.so library audio playback




            


Question: In C ++ code, if you can call libmedia.so android system, I use C ++ to write a test program, called libmedia.so in mediaplayer.cpp method for audio playback, you can compile and to be in the android system The set-top box to perform, but prepare () method has been blocked, seek the guidance of the great God how to solve ah, to the point of thinking, okay? The following is the test code:

#include & lt; stdio.h & gt;
#include & lt; stdlib.h & gt;
#include & lt; mediaplayer.h & gt;

using namespace android;

int main ()
{
int iRet = 0;
MediaPlayer * p = new MediaPlayer ();

iRet = p- & gt; setDataSource ("/ data / j2me / phoneme-cache / 061075.midi", NULL);
if (0! = iRet)
{
printf ("[setDataSource] iRet =% d \ n", iRet);
}

iRet = p- & gt; setAudioStreamType (3);
if (0! = iRet)
{
printf ("[setAudioStreamType] iRet =% d \ n", iRet);
}

iRet = p- & gt; prepare ();
if (0! = iRet)
{
printf ("[prepare] iRet =% d \ n", iRet);
}

iRet = p- & gt; start ();
if (0! = iRet)
{
printf ("[start] iRet =% d \ n", iRet);
}

p- & gt; stop ();
return 0;
}

Reply:
Come seeking guidance ah, tangled for several days, do not resolve to collapse. . . . .
Reply:
quote 1 floor dengxuguang reply:
come seeking guidance ah, tangled for several days, do not resolve to collapse. . . . .

You look at the source code libmedia android call flow. . .
Reply:
quote the second floor guoyoulei520 reply:
Quote: quote 1 floor dengxuguang reply:

Come seeking guidance ah, tangled for several days, do not resolve to collapse. . . . .

You look at the source code libmedia android call flow. . .


Read, the process from top to bottom is MediaPlayer --- & gt; libmedia_jni.so ---- & gt; libmedia.so ------- & gt; libmediaplayerserver.so ------ & gt; ALSA library.
Audio playback process is setDatasource () \ prepare () \ start () .......
But called directly by the library so that there is a problem
Seeking pointing
Reply:
quote 3rd floor dengxuguang reply:
Quote: quote, 2nd Floor guoyoulei520 reply:

Quote: quote 1 floor dengxuguang reply:

Come seeking guidance ah, tangled for several days, do not resolve to collapse. . . . .

You look at the source code libmedia android call flow. . .


Read, the process from top to bottom is MediaPlayer --- & gt; libmedia_jni.so ---- & gt; libmedia.so ------- & gt; libmediaplayerserver.so ------ & gt; ALSA library.
Audio playback process is setDatasource () \ prepare () \ start () .......
But called directly by the library so that there is a problem
Seeking pointing


java code level playing media have setDatasource. prepare. The corresponding process you have seen it ....


Is not a privilege or other problems? Facie prepare function, under what circumstances would clog ah
Reply:
quote 4th floor guoyoulei520 reply:
Quote: 3rd floor dengxuguang quote reply:

Quote: quote, 2nd Floor guoyoulei520 reply:

Quote: quote 1 floor dengxuguang reply:

Come seeking guidance ah, tangled for several days, do not resolve to collapse. . . . .

You look at the source code libmedia android call flow. . .


Read, the process from top to bottom is MediaPlayer --- & gt; libmedia_jni.so ---- & gt; libmedia.so ------- & gt; libmediaplayerserver.so ------ & gt; ALSA library.
Audio playback process is setDatasource () \ prepare () \ start () .......
But called directly by the library so that there is a problem
Seeking pointing


java code level playing media have setDatasource. prepare. The corresponding process you have seen it ....


Is not a privilege or other problems? Facie prepare function, under what circumstances would clog ah


Open log with the next process, libmedia.so is communicating through binder and libmediaplayer.so, libmediaplayer.so in the system is / system / bin / mediaserver this service to provide services, libmediaplayer.so received libmedia.so (my test program processes) executed after prepare () request has actually made the prepare (), and found that the results of comparison by log is correct, but the real reason is that libmediaplayer.so blocked implementation of End prepare () failure by the binder after the results back to the test procedure, causing the test program has been blocked, the question now is not quite sure why the callback will fail, had never been engaged android, audio architecture IBinder mechanisms do not understand, do not IBinder have to go to find out the mechanism, going crazy, there is a way to directly call libmediaplayer.so, avoid Binder communications libmedia.so and libmediaplayer.so, the problem is I compiled a little, a lot of compilation problems, Tragedy ah
Reply:
quote 5th floor dengxuguang reply:
Quote: quote, 4th Floor guoyoulei520 reply:

Quote: 3rd floor dengxuguang quote reply:

Quote: quote, 2nd Floor guoyoulei520 reply:

Quote: quote 1 floor dengxuguang reply:

Come seeking guidance ah, tangled for several days, do not resolve to collapse. . . . .

You look at the source code libmedia android call flow. . .


Read, the process from top to bottom is MediaPlayer --- & gt; libmedia_jni.so ---- & gt; libmedia.so ------- & gt; libmediaplayerserver.so ------ & gt; ALSA library.
Audio playback process is setDatasource () \ prepare () \ start () .......
But called directly by the library so that there is a problem
Seeking pointing


java code level playing media have setDatasource. prepare. The corresponding process you have seen it ....


Is not a privilege or other problems? Facie prepare function, under what circumstances would clog ah


Open log with the next process, libmedia.so is communicating through binder and libmediaplayer.so, libmediaplayer.so in the system is / system / bin / mediaserver this service to provide services, libmediaplayer.so received libmedia.so (my test program processes) executed after prepare () request has actually made the prepare (), and found that the results of comparison by log is correct, but the real reason is that libmediaplayer.so blocked implementation of End prepare () failure by the binder after the results back to the test procedure, causing the test program has been blocked, the question now is not quite sure why the callback will fail, had never been engaged android, audio architecture IBinder mechanisms do not understand, do not IBinder have to go to find out the mechanism, going crazy, there is a way to directly call libmediaplayer.so, avoid Binder communications libmedia.so and libmediaplayer.so, the problem is I compiled a little, a lot of compilation problems, Tragedy ah

Then you reference android_media_MediaPlayer.cpp it, it should be, there are IPC calls, you refer to the following
Reply:
quote, 6th Floor guoyoulei520 reply:
Quote: quote, 5th Floor dengxuguang reply:

Quote: quote, 4th Floor guoyoulei520 reply:

Quote: 3rd floor dengxuguang quote reply:

Quote: quote, 2nd Floor guoyoulei520 reply:

Quote: quote 1 floor dengxuguang reply:

Come seeking guidance ah, tangled for several days, do not resolve to collapse. . . . .

You look at the source code libmedia android call flow. . .


Read, the process from top to bottom is MediaPlayer --- & gt; libmedia_jni.so ---- & gt; libmedia.so ------- & gt; libmediaplayerserver.so ------ & gt; ALSA library.
Audio playback process is setDatasource () \ prepare () \ start () .......
But called directly by the library so that there is a problem
Seeking pointing


java code level playing media have setDatasource. prepare. The corresponding process you have seen it ....


Is not a privilege or other problems? Facie prepare function, under what circumstances would clog ah


Open log with the next process, libmedia.so is communicating through binder and libmediaplayer.so, libmediaplayer.so in the system is / system / bin / mediaserver this service to provide services, libmediaplayer.so received libmedia.so (my test program processes) executed after prepare () request has actually made the prepare (), and found that the results of comparison by log is correct, but the real reason is that libmediaplayer.so blocked implementation of End prepare () failure by the binder after the results back to the test procedure, causing the test program has been blocked, the question now is not quite sure why the callback will fail, had never been engaged android, audio architecture IBinder mechanisms do not understand, do not IBinder have to go to find out the mechanism, going crazy, there is a way to directly call libmediaplayer.so, avoid Binder communications libmedia.so and libmediaplayer.so, the problem is I compiled a little, a lot of compilation problems, Tragedy ah

Then you reference android_media_MediaPlayer.cpp it, it should be, there are IPC calls, you refer to the


The document read, is JNI this layer, it calls down libmedia.so, in libmedia.so which only communicate via binder and liblibmediaplayerservice.so, I looked at the code to communicate, I feel more complicated to get estimate clearly take a long time, I am here and more anxious, depressed
Reply:
Great God seeking guidance and direction to the right
Reply:
Directly call libmediaplayer.so interface does not work, the library is a service in the form of external service provider, its constructor is private, so there is no way to directly call.

Went back to the original problem, call libmedia.so communicate with libmediaplayer.so, libmedia.so remote call libmediaplayer.so no problem, libmediaplayer.so also performed correctly, but in libmediaplayer.so notify the remote call libmedia.so Interface Shique problems, ask God to the point of thinking big
Reply:
The reply to be removed administrator 2013-07-23 08:49:34

Reply:
Seek advice. . . . . . . .
Reply:
Seek the guidance of the great God, really I can not find the information.

Reply:
This question is difficult to do? No one has done a thing in this regard? Really want to know who gave suggestions, your sentence might make me suddenly, why do you ask questions, so few answers do not understand is CSDN increasingly strained, or people are increasingly indifferent
Reply:
There is no obligation to people you solve the problem.
Reply:
quote the 14th floor river80 reply:
obligation to people you do not solve the problem.


You're right, people really have no obligation for me to solve the problem, but the technology has always been to communicate, but if we are indifferent to other people's problems seriously, then perhaps one day when you have a problem, you go to ask who?
Reply:
The problem has been solved, because the call to End prepare () emperor thread is blocked, there is no thread to read to libmediaplayerservice.so pass over the callback messages, the place to start plus ProcessState :: self () - & gt; startThreadpool () on can, still lack a deep understanding of the binder, ah, I take this opportunity to study in depth under binder.
Reply:
Very nice, oh you look at the top
Reply:
using namespace android; android newspaper red? ?
Reply:
Will the landlord of cpp is compilation of what platform? Under elaborate on it, and I also want to direct calls to libmedia.so library Java program that uses jni technology.
Reply:
08-27 15: 15: 41.484 I / UrlCheck (107): isUrlRealM3U8 in, ptr: 0x417e0780, url: /mnt/sdcard/abc.mp3
08-27 15: 15: 41.484 I / UrlCheck (107): UrlCheckHelper ptr: 0x417e0780, url_type: 0
08-27 15: 15: 41.594 I / ChromiumHTTPDataSourceSupport (107): Request failed with status 4 and os_error -300
08-27 15: 15: 41.594 E / AwesomePlayer (107): connect fail to url: /mnt/sdcard/abc.mp3
08-27 15: 15: 41.594 I / UrlCheck (107): url checked, reallyM3U8: 0

The landlord, hello, I'm also going to use Android underlying MediaPlay, in iRet = p- & gt; setDataSource ("/ mnt / sdcard / abc.mp3", NULL); I was wrong when they reported. You can answer me, what reason? Thank you - songs I've placed in the appropriate directory
Reply:
quote 20th floor xuie0000 reply:
08-27 15: 15: 41.484 I / UrlCheck (107): isUrlRealM3U8 in, ptr: 0x417e0780, url: / mnt / sdcard / abc.mp3
08-27 15: 15: 41.484 I / UrlCheck (107): UrlCheckHelper ptr: 0x417e0780, url_type: 0
08-27 15: 15: 41.594 I / ChromiumHTTPDataSourceSupport (107): Request failed with status 4 and os_error -300
08-27 15: 15: 41.594 E / AwesomePlayer (107): connect fail to url: /mnt/sdcard/abc.mp3
08-27 15: 15: 41.594 I / UrlCheck (107): url checked, reallyM3U8: 0

The landlord, hello, I'm also going to use Android underlying MediaPlay, in iRet = p- & gt; setDataSource ("/ mnt / sdcard / abc.mp3", NULL); I was wrong when they reported. You can answer me, what reason? Thank you - songs I've placed in the appropriate directory


I will iRet = p- & gt; setAudioStreamType (3); commented, you can play a song

No comments:

Post a Comment