[mythtv] audio.isPaused not working for OpenSLES audio
mark at digivation.com.au
Sat Jul 21 12:59:59 UTC 2018
On 7/21/2018 10:14 PM, Peter Bennett wrote:
> On 07/21/2018 03:09 AM, Mark Spieth wrote:
>> On 7/21/2018 9:04 AM, Peter Bennett wrote:
>>> On 07/20/2018 06:19 PM, Mark Spieth wrote:
>>>> On 7/21/2018 3:48 AM, Peter Bennett wrote:
>>>>> Hi Mark
>>>>> I assume you created the android OpenSLES audio support in MythTV.
>>>>> I found that audio.isPaused() always returns true, even in the
>>>>> middle of playing audio and video. This was causing audio-video
>>>>> sync to not work correctly. I fixed it by taking that check out.
>>>>> It was not necessary to check audio.isPaused() before calling
>>>>> Pause(). I just made it unconditionally call Pause() whether it
>>>>> was already paused or not. However I wonder if there is an error
>>>>> that is causing it to always return isPaused() as true and whether
>>>>> that may cause other problems.
>>>> That is strange. All the paused processing is in AudioOutputBase,
>>>> and except for Jack and CA there is nothing in any of the other
>>>> This is probably affecting many drivers then.
>>>> Is this with or without stretch enabled? There is a bit of a
>>>> difference there. I will dig some more today.
>>> Stretch was not enabled. This is the code that pauses audio right at
>>> the start of live tv to allow the video to catch up. the audio was
>>> never being paused. MythPlayer::PrebufferEnoughFrames - also
>>> MythPlayer::AVSync where audio.isPaused is checked before
>> What it should be doing is initially its in pause until bufferred
>> mode. If you ry an unpause it will stay in that mode until the first
>> audio data is written/queued.
>> So when you start playing, yes it is in paused mode until you write
>> the first audio data, when it un-pauses.
>> If you are withholding audio data, then it will stay paused until you
>> write the first data.
>> Can you post a patch as to what you are trying to do and I will see
>> if there is a better way.
>> Building your latest patch with master now.
> It is working as it should with my latest patch.
> The attached two patches are part of my big patch, and they remove
> tests of audio.isPaused. Those audio.isPaused calls are in the
> existing code and are not necessary since you can call Pause when it
> is paused anyway.
> If you revert these two patches, then start Live TV on Shield, it
> jerks and hiccups forever, until you manually pause and resume.
> I think it is best to leave these two places not calling isPaused. I
> was just concerned that other things may be affected by the isPause
> being wrong.
I'm concerned with races happening when you do want to pause manually
due to the threads involved with this solution.
Still looking at the consequences.
It may be worth while setting up a unit test but I haven't looked into
the framework that's in place. I tend to use google test and google mock
for all mine because you can fake the surrounding components easily.
This would show up any faults with the audio subsystem, and there appear
to be some.
More information about the mythtv-dev