Google Groups Home
Help | Sign in
custom audio renderer glitch
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
jgma  
View profile  
 More options Dec 2 2008, 8:16 am
Newsgroups: microsoft.public.win32.programmer.directx.audio
From: jgma <mjg1...@live.cn>
Date: Tue, 2 Dec 2008 05:16:04 -0800
Local: Tues, Dec 2 2008 8:16 am
Subject: custom audio renderer glitch

Hi all,
i have writen a custom audio renderer filter which inherits CBaseRenderer,

the renderer works well most time, but causing audio glitch sometimes. the

samples arrived renderer usually  early hundreds of ms , but the time wasted

in CBaseRender::WaitForRenderTime -- the sample wait its presentation time.
if the sample arrive late exceptionally, this causing the audio glitch.

i once made a test: i put a null in-place filter upstream microsoft's
default directsound

renderer, i find that the renderer buffered about 1800ms data, if i pause the

graph, the render remain receiveing samples.
so i want to add a queue like COutputQueue in my filter or in custom input

pin, but i have no clues  to implemented that, i want to buffer more data

avoiding  audio glitch, and alter existing code less.

can you give me some  hints?
where is the best place to put a queue, in input pin class or in renderer

filter?
how to control the filter's state and stream?

thank you in advance , any help  would be greatly appreciated
--
please excuse me if my writing isn''t professional, technical and courteous.
i try to improve my poor english .


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris P.  
View profile  
 More options Dec 2 2008, 11:22 am
Newsgroups: microsoft.public.win32.programmer.directx.audio
From: "Chris P." <m...@chrisnet.net>
Date: Tue, 2 Dec 2008 11:22:36 -0500
Local: Tues, Dec 2 2008 11:22 am
Subject: Re: custom audio renderer glitch

Contrary to what might seem obvious, audio renderers should not be derived
from CBaseRender.  You should instead derive from CBaseFilter adding in the
appropriate code.

The Microsoft renderers use the audio buffers (DirectSound/waveOut) to
buffer about 1 second of audio data.  The sample received at the input pin
is copied immediately to the audio buffer and released.  If there is no
room in the audio buffer then the sample is held (blocking) until there is
room.  There is no need to wait for presentation time as the audio device
itself dictates the rate of presentation.  In the simplest case you can
ignore all time stamps and not have a reference clock if you are playing
just audio with no video to sync.  If you need video sync then you need to
add a reference clock to the filter with the reference clock time derived
from the actual audio render position.  

--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jgma  
View profile  
 More options Dec 2 2008, 8:27 pm
Newsgroups: microsoft.public.win32.programmer.directx.audio
From: jgma <mjg1...@live.cn>
Date: Tue, 2 Dec 2008 17:27:01 -0800
Local: Tues, Dec 2 2008 8:27 pm
Subject: Re: custom audio renderer glitch

"Chris P." wrote:
> Contrary to what might seem obvious, audio renderers should not be derived
> from CBaseRender.  You should instead derive from CBaseFilter adding in the
> appropriate code.

are there any disadvantages dereived from CBaseRender?
the microsoft doc says :The CBaseRenderer class is a base class for
implementing renderer filters.
ms-help://MS.MSSDK.1033/MS.WinSDK.1033/directshow/htm/cbaserendererclass.ht m
what is CBaseRender used for?

> The Microsoft renderers use the audio buffers (DirectSound/waveOut) to
> buffer about 1 second of audio data.  The sample received at the input pin
> is copied immediately to the audio buffer and released.  

if i create a 1 second buffer(DirectSoundBuffer8), run the graph, the first
sample arrived at
audio render early 300 ms, put it immediately in the buffer, when to play
the buffer?
ignore the sample's time stampe?

>If there is no
> room in the audio buffer then the sample is held (blocking) until there is
> room.  There is no need to wait for presentation time as the audio device
> itself dictates the rate of presentation.  In the simplest case you can
> ignore all time stamps and not have a reference clock if you are playing
> just audio with no video to sync.  If you need video sync then you need to
> add a reference clock to the filter with the reference clock time derived
> from the actual audio render position.  

yes i need video sync, i have add a reference clock to the costom renderer,
when the buffer is

playing , use buffer position to retrieve time, otherwise, use system clock
increase the time.

i once made some tests in graph, put a null in place filter upstream
microst's diectsound renderer,

alter sample's time stamp , the render works exceptionly, if "
The sample received at the input pin is copied immediately to the audio
buffer and released. "

the render should work the same as not altering timestamp.
--
please excuse me if my writing isn''t professional, technical and courteous.
i try to improve my poor english .


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris P.  
View profile  
 More options Dec 3 2008, 10:04 am
Newsgroups: microsoft.public.win32.programmer.directx.audio
From: "Chris P." <m...@chrisnet.net>
Date: Wed, 3 Dec 2008 10:04:46 -0500
Local: Wed, Dec 3 2008 10:04 am
Subject: Re: custom audio renderer glitch

On Tue, 2 Dec 2008 17:27:01 -0800, jgma wrote:
> are there any disadvantages dereived from CBaseRender?
> the microsoft doc says :The CBaseRenderer class is a base class for
> implementing renderer filters.
> ms-help://MS.MSSDK.1033/MS.WinSDK.1033/directshow/htm/cbaserendererclass.ht m
> what is CBaseRender used for?

CBaseRenderer was primarily intended for video rendering.  It contains
presentation scheduling code that is completely irrelevant for audio.  It
actually has the potential for deadlock when used with certain players.

> if i create a 1 second buffer(DirectSoundBuffer8), run the graph, the first
> sample arrived at
> audio render early 300 ms, put it immediately in the buffer, when to play
> the buffer?
> ignore the sample's time stampe?

You don't have to ignore the time stamps, but in the simplest cases the
time stamps will always be linear and derived from the samplerate/sample
count.  If you decide to use time stamps then you have to decide what
exactly do these time stamps mean to you?  Audio samples are almost never
sent with gaps, if there are gaps you would be responsible for filling in
the gap with something (silence/noise etc).  You should stay in the paused
state until you have enough data buffered to maintain smooth playback, then
allow the transition to running.

> yes i need video sync, i have add a reference clock to the costom renderer,
> when the buffer is

> playing , use buffer position to retrieve time, otherwise, use system clock
> increase the time.

> i once made some tests in graph, put a null in place filter upstream
> microst's diectsound renderer,

> alter sample's time stamp , the render works exceptionly, if "
> The sample received at the input pin is copied immediately to the audio
> buffer and released. "

> the render should work the same as not altering timestamp.

I don't understand what you are trying to say here.

--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jgm  
View profile  
 More options Dec 4 2008, 9:09 am
Newsgroups: microsoft.public.win32.programmer.directx.audio
From: jgm <j...@discussions.microsoft.com>
Date: Thu, 4 Dec 2008 06:09:01 -0800
Local: Thurs, Dec 4 2008 9:09 am
Subject: Re: custom audio renderer glitch
thank you so much for your answer, chris.

>CBaseRenderer was primarily intended for video rendering. It contains
>presentation scheduling code that is completely irrelevant for audio. It
>actually has the potential for deadlock when used with certain players.

by reading your another post in microsoft forums, i have read the artical
(http://blogs.msdn.com/mediasdkstuff/archive/2008/09/19/custom-directs...

audio-renderer-hangs-playback-in-windows-media-player-11.aspx)
are you the artical's author? i have explorered your net

(http://www.chrisnet.net/code.htm) and download the codes. do you have a

public blog site?  do you write technical artical blog?

>Audio samples are almost never sent with gaps, if there are gaps you would
>be responsible for filling in the gap with something (silence/noise etc).
>You should stay in the paused state until you have enough data buffered to
>maintain smooth playback, then allow the transition to running.

i once made a test, the scenario is following:

in my graph,put a null in-place filter upstream microsoft default directsound

renderer, implement CTransInPlaceFilter::Transform as following:

there is a  gap in between two samples,

Transform(IMediaSample *pSample)
{
    CheckPointer(pSample,E_POINTER);  
    DbgFunc("Transform");
 REFERENCE_TIME tStart = 0;
 REFERENCE_TIME tEnd = 0;
    pSample->GetTime(&tStart,&tEnd);
    tStart = tStart + (tEnd - tStart) /2;
 pSample->SetTime(&tStart,&tEnd);

 UINT len = pSample->GetActualDataLength();
 len /= 2;
 pSample->SetActualDataLength(len);
 return NOERROR;

}

the  result is that video playback like 2x playback, i once ask this question

in micsoft forum, but i dont understand why the playback like 2x. can you
give

me a detail answer?

there are not enough docs for implementing a audio render, so i have to

search the internet again and again, and ask many questions in forums. by now

, the custom audio render implemented by me works well, the only fault is

occuring glitch sometimes. when i encounter a new problem, it's difficult for

me to resolve it, there are no directions .

why does mirsoft directshow group  not write some docs for implementing  a
audio render or

write a base class for audio render,there are base class  and samples for

video renderer.

--
please excuse me if my writing isn''''t professional, technical and courteous.
i try to improve my poor english .


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris P.  
View profile  
 More options Dec 4 2008, 10:08 am
Newsgroups: microsoft.public.win32.programmer.directx.audio
From: "Chris P." <m...@chrisnet.net>
Date: Thu, 4 Dec 2008 10:08:35 -0500
Local: Thurs, Dec 4 2008 10:08 am
Subject: Re: custom audio renderer glitch

On Thu, 4 Dec 2008 06:09:01 -0800, jgm wrote:
> by reading your another post in microsoft forums, i have read the artical
> (http://blogs.msdn.com/mediasdkstuff/archive/2008/09/19/custom-directs...

> audio-renderer-hangs-playback-in-windows-media-player-11.aspx)
> are you the artical's author? i have explorered your net

> (http://www.chrisnet.net/code.htm) and download the codes. do you have a

> public blog site?  do you write technical artical blog?

I am not the article's author, it appears to be someone working at
Microsoft.  I don't have a blog site.

You changed the start time without changing the stop time which is going to
make for some very strange overlapping time spans.

A base class for audio renderers wouldn't really be needed, it would be a
fairly empty class.  If you are writing an audio renderer then it is
usually going to be a fair bit different from the standard Microsoft
implementation.  I think more useful would be if Microsoft published the
source code for the DirectSound and waveOut renderers so that people can
how to handle timing, syncing etc.

--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google