Audio stops after some time in android from video/Music player

by getandroid » Mon, 16 Feb 2009 12:15:59 GMT


Sponsored Links
 Hi,

   I'm facing a problem with Video/Music player where audio stops
coming after a random number of times. After some debugging I found
that:

In android_audio_output.cpp->audout_thread_func, there is
iAudioThreadSem->Wait(); before the while(1) loop and it is stuck
there indefinitely. I understand it is waiting for a signal from MIO
saying that the buffer is written and ready to be dumped to audio
flinger. For some reason it is not getting the signal. Is this
correct?

Can anybody throw some light on this?
--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



Audio stops after some time in android from video/Music player

by Dave Sparks » Mon, 16 Feb 2009 16:28:07 GMT


 Which branch are you working on?



--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---


Sponsored Links


Audio stops after some time in android from video/Music player

by getandroid » Mon, 16 Feb 2009 20:01:41 GMT


 Hi,

   As mentioned audio stops after some random number of times when
played from either Music/Video player. After some debugging, I found
that the problem is:

In "android_audio_output.cpp"->audout_thread_func() there is a call to
wait(iAudioThreadSem->Wait()) just before the while(1) and it is
waiting indefinitely for something.

Can anybody tell me what is it waiting for and why is it not able to
come out? From what I can understand, it is waiting for a signal
(semaphore) but where is it expecting a signal from?
--~--~---------~--~----~------------~-------~--~----~



Audio stops after some time in android from video/Music player

by Dave Sparks » Tue, 17 Feb 2009 00:57:42 GMT


 Please don't cross-post. This question isn't appropriate for the
application developer forum.



--~--~---------~--~----~------------~-------~--~----~



Audio stops after some time in android from video/Music player

by getandroid » Tue, 17 Feb 2009 05:41:09 GMT


 I'm working on android 1.0 release




--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



Audio stops after some time in android from video/Music player

by getandroid » Tue, 17 Feb 2009 08:19:59 GMT


 I've done following change in android_audio_output.cpp. It is better
after enabling RESET mode instead of STOP. Is there any fix for PV
core which mentioned in the comments of code snippet below??

# if 0 //SAMPATH commented
// FIXME: Per PV, we should be exiting thread in Reset, not Stop.
However, doing so
// causes app death, so presumably PV is asserting somewhere and
causing an abort.
// When this gets fixed, remove this Stop function and bring back the
Reset function.
PVMFCommandId AndroidAudioOutput::Stop(const OsclAny* aContext)
{
    // request output thread to exit
    LOGV("Stop (%p)", aContext);
    RequestAndWaitForThreadExit();
    return AndroidAudioMIO::Stop(aContext);
}
#endif

#if 1 //SAMPATH enabled
PVMFCommandId AndroidAudioOutput::Reset(const OsclAny* aContext)
{
    // request output thread to exit
    LOGV("Reset (%p)", aContext);
    RequestAndWaitForThreadExit();
    return AndroidAudioMIO::Reset(aContext);
}
#endif





--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



Other Threads

1. ListView Choices: What the devil is happening?

I wrote a small activity which illustrates some crazy behavior I found
while implementing ListView and choices.  Feel free to plug this in
and try it yourselves (and be sure to check logcat as well):

public class TestActivity extends ListActivity {

        public String[] strings = { "What","the","devil","is","happening?" };

        @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.listview);
        getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        getListView().setAdapter(new
ArrayAdapter<String>(this,R.layout.main,strings));
        getListView().setOnItemClickListener(new OnItemClickListener()
{
                        public void onItemClick(AdapterView<?> arg0, View arg1, 
int arg2,
                                        long arg3) {
                                        Log.d("test","Checked: "+
((TextView)getListView().getChildAt(arg2)).getText().toString());
                                        if (getListView().isItemChecked(arg2))
                                        {
                                                for (int i=0; 
i<getListView().getChildCount(); i++)
                                                {
                                                        if (i==arg2)
                                                                
getListView().getChildAt(i).setBackgroundColor(Color.MAGENTA);
                                                        else
        
getListView().getChildAt(i).setBackgroundColor(Color.TRANSPARENT);
                                                }
                                        }
                                        else
        
getListView().getChildAt(arg2).setBackgroundColor(Color.TRANSPARENT);

                                }
        });
    }
}

The R.layout.main is just your standard default TextView when you
create a new project in Eclipse.  The R.layout.listview is the
standard LinearLayout with embedded ListView for ListActivities shown
below:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
      android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    >
        <ListView android:id="@+id/android:list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
    />
</LinearLayout>

Can anyone explain rationally what is causing this to happen?
--~--~---------~--~----~------------~-------~--~----~

2. Create Data Base

Hi all, i was loking for an example of how to create a date base in
sqlitedabase, but I was'n lucky. May someone help me whit that, maybe
an example or a document. Thanks
--~--~---------~--~----~------------~-------~--~----~

3. Android developer Challenge 2

4. PlayScreen launches portal with 20 free games for the new T-Mobile G1 (Google Android) Phone.

5. Nice Paying and Quick Project for an Android Developer

6. Google Android Code Down

7. SpriteText Projector