Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Commits

Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1

 

 

First page Previous page 1 2 Next page Last page  View All MythTV commits RSS feed   Index | Next | Previous | View Threaded


noreply at mythtv

Mar 14, 2012, 6:04 PM

Post #26 of 38 (285 views)
Permalink
Re: Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1 [In reply to]

#10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1
------------------------------------------+--------------------------------
Reporter: blazej.lewcio@… | Owner: jyavenard
Type: Bug Report - General | Status: infoneeded_new
Priority: minor | Milestone: unknown
Component: MythTV - Audio Output | Version: Unspecified
Severity: medium | Resolution:
Keywords: upmixing | Ticket locked: 0
------------------------------------------+--------------------------------

Comment (by jyavenard):

Now that you mention that the AC3 encoder is in use. It all makes sense.
And you're looking at a non-issue

For a start, the encoder is re-created during each reconfigure..
(Actually looks like there is a potential leak, the encoder isn't deleted
if it already exists...)

2nd, doing a reset of the encoder is useless. It will always exhaust all
the data it has been provided after it exits. so by the time it's finished
processing the data given in AddFrames, it is always empty

3rd: It's perfectly okay for org_waud to not be a multiple of
bytesperframe. The audio is upmixed within the ringbuffer only as
temporary storage. It is immediately compressed as AC3 and bytesperframe
there isn't 24 anymore, but 4. You'll find that all those values are
multiples of 4 as expected

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10396#comment:25>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Mar 14, 2012, 6:56 PM

Post #27 of 38 (286 views)
Permalink
Re: Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1 [In reply to]

#10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1
------------------------------------------+--------------------------------
Reporter: blazej.lewcio@… | Owner: jyavenard
Type: Bug Report - General | Status: infoneeded_new
Priority: minor | Milestone: unknown
Component: MythTV - Audio Output | Version: Unspecified
Severity: medium | Resolution:
Keywords: upmixing | Ticket locked: 0
------------------------------------------+--------------------------------

Comment (by markspieth):

it does explain 16 sec audio glitch period as the rate is now right @
48k*4bytes * 3072000.

1. encoder not recreated if no change is detected AFAICT.

2. it will output old data for a short period before new data is output
after stream change. proc state clear in reset is still advisable but not
a (the) glitch generator.

3. encoder->Encode is called with bdiff (byte not frame multiple) which is
not aligned to 6ch bpf which means it will absorb a fractional
unset/uninited sample at buffer wrap time and then shift/rotate channel
presentation to the encoder. fix waud reset and this will go away
irrespective of the output bpf or fix incomplete buffer wrap condition in
Encode wrap part.

Also I did extensive tests with audio out 6ch and I couldn't get it to
fail in the way described.

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10396#comment:26>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Mar 14, 2012, 7:18 PM

Post #28 of 38 (281 views)
Permalink
Re: Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1 [In reply to]

#10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1
------------------------------------------+--------------------------------
Reporter: blazej.lewcio@… | Owner: jyavenard
Type: Bug Report - General | Status: infoneeded_new
Priority: minor | Milestone: unknown
Component: MythTV - Audio Output | Version: Unspecified
Severity: medium | Resolution:
Keywords: upmixing | Ticket locked: 0
------------------------------------------+--------------------------------

Comment (by markspieth):

added patch for notify purposes.

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10396#comment:27>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Mar 14, 2012, 7:39 PM

Post #29 of 38 (283 views)
Permalink
Re: Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1 [In reply to]

#10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1
------------------------------------------+--------------------------------
Reporter: blazej.lewcio@… | Owner: jyavenard
Type: Bug Report - General | Status: infoneeded_new
Priority: minor | Milestone: unknown
Component: MythTV - Audio Output | Version: Unspecified
Severity: medium | Resolution:
Keywords: upmixing | Ticket locked: 0
------------------------------------------+--------------------------------

Comment (by jyavenard):

while it does make sense to reset, in effect it's not necessary as none of
the encoder will effectively buffer any data

I am fairly certain it wouldn't fix the issue the OP is seeing...

If you actually had a closer look on what it is actually doing, it
actually works that way:
org_waud = waud = next position to write
if (upmixing)
{
upmix and copy into org_waud and update it
update number_of_frames_added
}

if (encoder)
{
// go back to beginning of new audio added:
org_waud = waud
encode number_of_frames_added
}

so where the upmixer write its data is irrelevant, the encoder will start
from where the upmixer started.
As the AC3 encoder will always produce a smaller output, there's no
overlap of any kind.

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10396#comment:28>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Mar 14, 2012, 8:26 PM

Post #30 of 38 (289 views)
Permalink
Re: Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1 [In reply to]

#10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1
------------------------------------------+--------------------------------
Reporter: blazej.lewcio@… | Owner: jyavenard
Type: Bug Report - General | Status: infoneeded_new
Priority: minor | Milestone: unknown
Component: MythTV - Audio Output | Version: Unspecified
Severity: medium | Resolution:
Keywords: upmixing | Ticket locked: 0
------------------------------------------+--------------------------------

Comment (by markspieth):

I think you misunderstand.
Another way would be like this

{{{
int bdFrames = bdiff / bpf;
encoder->Encode(WPOS, bdFrames * bpf, processing ? FORMAT_FLT : format);
to_get = encoder->Encode(ABUF, len - bdFrames * bpf,
}}}

however I think there are other cases and the proposed patch just handles
everything intrinsically due to raud = 0 in Reset()

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10396#comment:29>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Mar 14, 2012, 8:34 PM

Post #31 of 38 (285 views)
Permalink
Re: Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1 [In reply to]

#10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1
------------------------------------------+--------------------------------
Reporter: blazej.lewcio@… | Owner: jyavenard
Type: Bug Report - General | Status: infoneeded_new
Priority: minor | Milestone: unknown
Component: MythTV - Audio Output | Version: Unspecified
Severity: medium | Resolution:
Keywords: upmixing | Ticket locked: 0
------------------------------------------+--------------------------------

Comment (by jyavenard):

even if you do set raud to 0 during reset. it doesn't explain why
corruption would occur every 16s... because reset isn't called every 16s.

All what you patch does is prevent old audio to be heard right after a
reset. Which isn't what the OP is experiencing

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10396#comment:30>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Mar 14, 2012, 9:20 PM

Post #32 of 38 (284 views)
Permalink
Re: Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1 [In reply to]

#10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1
------------------------------------------+--------------------------------
Reporter: blazej.lewcio@… | Owner: jyavenard
Type: Bug Report - General | Status: infoneeded_new
Priority: minor | Milestone: unknown
Component: MythTV - Audio Output | Version: Unspecified
Severity: medium | Resolution:
Keywords: upmixing | Ticket locked: 0
------------------------------------------+--------------------------------

Comment (by jyavenard):

blazej.lewcio [at] googlemail, can you try the small patch above and post
the output?

I just want to see if we ever get into the case where the audio data
doesn't fit precisely the buffer..

Which could explain the corruption that you are seeing...

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10396#comment:31>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Mar 14, 2012, 9:58 PM

Post #33 of 38 (286 views)
Permalink
Re: Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1 [In reply to]

#10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1
------------------------------------------+--------------------------------
Reporter: blazej.lewcio@… | Owner: jyavenard
Type: Bug Report - General | Status: infoneeded_new
Priority: minor | Milestone: unknown
Component: MythTV - Audio Output | Version: Unspecified
Severity: medium | Resolution:
Keywords: upmixing | Ticket locked: 0
------------------------------------------+--------------------------------

Comment (by jyavenard):

Mark, after looking further into this, while setting raud = 0 would reduce
the issue from occurring, it doesn't guarantee that it won't happen. Plus
there's the issue that due to a race condition with the write audio thread
that raud wouldn't be set to 0 anyway (in the log above, you can clearly
see that it's precisely what's occurring, actually_paused is set to 1
after Reset has been called).

So the main issue is that all the data written prior calling the AC3
encoder do not exactly fit into the ringbuffer and everything would get
shifted..

I don't know how we could fix this without either changing on the fly the
length of the ringbuffer (and then you have threading issues), or by using
a separate buffer for performing the upmixing...

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10396#comment:32>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Mar 14, 2012, 10:10 PM

Post #34 of 38 (289 views)
Permalink
Re: Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1 [In reply to]

#10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1
------------------------------------------+--------------------------------
Reporter: blazej.lewcio@… | Owner: jyavenard
Type: Bug Report - General | Status: infoneeded_new
Priority: minor | Milestone: unknown
Component: MythTV - Audio Output | Version: Unspecified
Severity: medium | Resolution:
Keywords: upmixing | Ticket locked: 0
------------------------------------------+--------------------------------

Comment (by markspieth):

My understanding is that Reset which I care about is called when unpause
occurs from PauseUntilBuffered which would do the correct thing (in this
case). Which is why I put in the safety of only doing it when paused.

I still think it will work the way I think.

If its not, handle it asyncly in the output thread with a flag set in
Reset() to reset raud and waud there.

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10396#comment:33>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Mar 14, 2012, 10:21 PM

Post #35 of 38 (282 views)
Permalink
Re: Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1 [In reply to]

#10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1
------------------------------------------+--------------------------------
Reporter: blazej.lewcio@… | Owner: jyavenard
Type: Bug Report - General | Status: infoneeded_new
Priority: minor | Milestone: unknown
Component: MythTV - Audio Output | Version: Unspecified
Severity: medium | Resolution:
Keywords: upmixing | Ticket locked: 0
------------------------------------------+--------------------------------

Comment (by jyavenard):

I'm actually thinking of doing it the following way:

make the audiobuffer 32 bytes bigger than what it currently is. Then stop
using the constant kAudioRingBufferSize to determine the length of the
buffer, instead use a dynamic variable.
When doing a reset, the length of the audio buffer would actually be
changed so the length between raud (which is now the new waud) and
kAudioRingBufferSize is now a modulo of bpf.
That way there is no thread/locking issue, and we will always be able to
fit everything to the end of the buffer.

Doing so would actually remove the requirement of having such a big audio
buffer, simply because it needs to be a multiple of all the possible bpf
values

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10396#comment:34>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Mar 14, 2012, 10:27 PM

Post #36 of 38 (286 views)
Permalink
Re: Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1 [In reply to]

#10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1
------------------------------------------+--------------------------------
Reporter: blazej.lewcio@… | Owner: jyavenard
Type: Bug Report - General | Status: infoneeded_new
Priority: minor | Milestone: unknown
Component: MythTV - Audio Output | Version: Unspecified
Severity: medium | Resolution:
Keywords: upmixing | Ticket locked: 0
------------------------------------------+--------------------------------

Comment (by jyavenard):

And we still have the issues that the gap between waud and the end of the
audio buffer must be a multiple of bpf, which isn't guarantee coming out
of the encoder.
Although, this seems unlikely to occur often as much more people would
have reported the audio corruption earlier

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10396#comment:35>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Mar 15, 2012, 3:33 AM

Post #37 of 38 (273 views)
Permalink
Re: Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1 [In reply to]

#10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1
------------------------------------------+-----------------------------
Reporter: blazej.lewcio@… | Owner: jyavenard
Type: Bug Report - General | Status: closed
Priority: minor | Milestone: 0.25
Component: MythTV - Audio Output | Version: Unspecified
Severity: medium | Resolution: fixed
Keywords: upmixing | Ticket locked: 0
------------------------------------------+-----------------------------
Changes (by Github):

* status: infoneeded_new => closed
* resolution: => fixed
* milestone: unknown => 0.25


Comment:

Fully clear the audio ringbuffer when using AC3 re-encoder

When the audio buffer was reset, we could find ourselves in a situation
where a full audio frame may not have fitted at the end of the ring
buffer. This would have resulted in channels being shifted for a short
period of time when we rollled over in the buffer.
This situation could only happen when using the AC3 encoder as we change
the size of an audio frame half-way through.

When the AC3 re-encoder is in use, we now fully clear the audio buffer and
fill it with zero. That way at worse we hear silence instead of crap and
not have to worry about threading issues.

Add some extra logging that will clearly show an error should this
condition occurs again. Will help troubleshoot should any issues remain.

Additionally, from Mark Spieth, fully reset any audio processing unit that
could have cached old audio.

Should fix #10396
Thanks Mark for actually spotting what went wrong
Branch: master
Changeset: f8d2de08e982bd646d0a3e430ec8799f7494f8f8

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10396#comment:36>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits


noreply at mythtv

Mar 15, 2012, 2:59 PM

Post #38 of 38 (274 views)
Permalink
Re: Ticket #10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1 [In reply to]

#10396: Periodical, short audio artifacts in one the channels when upmixing to 5.1
------------------------------------------+-----------------------------
Reporter: blazej.lewcio@… | Owner: jyavenard
Type: Bug Report - General | Status: closed
Priority: minor | Milestone: 0.25
Component: MythTV - Audio Output | Version: Unspecified
Severity: medium | Resolution: fixed
Keywords: upmixing | Ticket locked: 0
------------------------------------------+-----------------------------

Comment (by blazej.lewcio@…):

Congrats! Problem fixed. I tested the commited code in master branch.
Thanks.

--
Ticket URL: <http://code.mythtv.org/trac/ticket/10396#comment:37>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
_______________________________________________
mythtv-commits mailing list
mythtv-commits [at] mythtv
http://www.mythtv.org/mailman/listinfo/mythtv-commits

First page Previous page 1 2 Next page Last page  View All MythTV commits RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.