<?xml version="1.0" encoding="iso-8859-1"?>
	<rss version="2.0" 
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		xmlns:admin="http://webns.net/mvcb/"
		xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
		xmlns:content="http://purl.org/rss/1.0/modules/content/">

	<channel>
		<title>VirtualBlog</title>
		<link>http://virtualdub.org/blog/index.php</link>
		<description>Life as the author of VirtualDub</description>
		<dc:language>en-us</dc:language>
		<dc:creator></dc:creator>
		<dc:rights>Copyright 2010</dc:rights>
		<dc:date>2010-07-11T20:31:06-04:00</dc:date>
		<admin:generatorAgent rdf:resource="http://www.pivotlog.net/?ver=Pivot+-+1.15%3A+%27Soundwave%27" />
		<admin:errorReportsTo rdf:resource="mailto:rsserrors@pivotlog.net"/>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
		<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
	<item>
		<title>DirectSound Renderer latency woes</title>
		<link>http://virtualdub.org/blog/pivot/entry.php?id=314</link>
		<comments>http://virtualdub.org/blog/pivot/entry.php?id=314#comm</comments>
		<description>I'm tweaking my laptop-as-a-TV setup again, and am running into problems with latency in the DirectShow filter graph.
The video path I cobbled together a while ago, and works as follows: I have preview&amp;nbsp;acceleration mode&amp;nbsp;activated VirtualDub and set to interlaced fields / even field first, which then pushes the video through a Direct3D pixel shader that does adaptive deinterlacing and upsampling to field rate with a little bit of bicubic filtering and gamma adjustment thrown in. That works surprisingly well, with good latency and a decent image. The problem is the audio, which initially starts out fine but slowly accumulates a lot of latency over time. I've spent a while fiddling with the filter graph clock and perusing the various (many) interfaces, and have determined the following:

Rate matching by data rate is active on the audio renderer.
The capture filter is sending 40ms audio buffers, and doesn't seem to respond to IAMBufferNegotiation requests to change it. Therefore, that's 40ms of audio latency I can't get rid of.
The DirectSound buffer size is about one second.
The buffer level reported through IAMAudioRendererStats very slowly rises over time, from about 4% to 90%.
Neither SyncUsingStreamOffset() + SetMaxGraphLatency() nor SetErrorTolerance() appear to help.
I had this same problem with my Adaptec GameBridge, and now it's happening with my ATI capture device, so I don't think it's capture driver specific.
It looks like the current problem is that the DirectSound Renderer is intent upon slowly filling up its one second buffer over time, even though that is a huge amount of latency to add to a live stream. For a live TV stream, that usually isn't a problem, as the audio and video just need to have the same amount of delay to be in sync. However, since I'm trying to play Ar Tonelico, any delay on either the audio or video stream results in a delay relative to the controller inputs, and I really don't want that amount of latency anywhere in the system. It's a bit frustrating that the audio system runs well at first but gradually slews to unusability until I reset the filter graph again.
Does anyone have any experience with this problem or tips as to how to solve it? I really don't want to have to write my own audio renderer, but I'm beginning to think that might be the best solution.</description>
		<guid isPermaLink="false">314@http://virtualdub.org/blog/</guid>
		<content:encoded><![CDATA[ <p>I'm tweaking my laptop-as-a-TV setup again, and am running into problems with latency in the DirectShow filter graph.</p>
<p>The video path I cobbled together a while ago, and works as follows: I have preview acceleration mode activated VirtualDub and set to interlaced fields / even field first, which then pushes the video through a Direct3D pixel shader that does adaptive deinterlacing and upsampling to field rate with a little bit of bicubic filtering and gamma adjustment thrown in. That works surprisingly well, with good latency and a decent image. The problem is the audio, which initially starts out fine but slowly accumulates a lot of latency over time. I've spent a while fiddling with the filter graph clock and perusing the various (many) interfaces, and have determined the following:</p>
<ul>
<li>Rate matching by data rate is active on the audio renderer.</li>
<li>The capture filter is sending 40ms audio buffers, and doesn't seem to respond to IAMBufferNegotiation requests to change it. Therefore, that's 40ms of audio latency I can't get rid of.</li>
<li>The DirectSound buffer size is about one second.</li>
<li>The buffer level reported through IAMAudioRendererStats very slowly rises over time, from about 4% to 90%.</li>
<li>Neither SyncUsingStreamOffset() + SetMaxGraphLatency() nor SetErrorTolerance() appear to help.</li></ul>
<p>I had this same problem with my Adaptec GameBridge, and now it's happening with my ATI capture device, so I don't think it's capture driver specific.</p>
<p>It looks like the current problem is that the DirectSound Renderer is intent upon slowly filling up its one second buffer over time, even though that is a huge amount of latency to add to a live stream. For a live TV stream, that usually isn't a problem, as the audio and video just need to have the same amount of delay to be in sync. However, since I'm trying to play Ar Tonelico, any delay on either the audio or video stream results in a delay relative to the controller inputs, and I really don't want that amount of latency anywhere in the system. It's a bit frustrating that the audio system runs well at first but gradually slews to unusability until I reset the filter graph again.</p>
<p>Does anyone have any experience with this problem or tips as to how to solve it? I really don't want to have to write my own audio renderer, but I'm beginning to think that might be the best solution.</p> ]]></content:encoded>
		<dc:subject>default</dc:subject>
		<dc:date>2010-07-11T12:17:00-04:00</dc:date>
    </item>

	<item>
		<title>The requested length is too int</title>
		<link>http://virtualdub.org/blog/pivot/entry.php?id=313</link>
		<comments>http://virtualdub.org/blog/pivot/entry.php?id=313#comm</comments>
		<description>The type long is problematic in C, because its exact type is not defined, and practically it can be either 32-bit or 64-bit on common platforms. Sometimes people will do a mass search-and-replace to change all variables declared as long to int in order to fix portability issues. If you do this, you need to make sure you check the diffs or you will end up publishing something nonsensical:
This function returns status values as follows:

    CBS_INVARG  requested file name length is too int</description>
		<guid isPermaLink="false">313@http://virtualdub.org/blog/</guid>
		<content:encoded><![CDATA[ <p>The type <em>long</em> is problematic in C, because its exact type is not defined, and practically it can be either 32-bit or 64-bit on common platforms. Sometimes people will do a mass search-and-replace to change all variables declared as <em>long</em> to <em>int</em> in order to fix portability issues. If you do this, you need to make sure you check the diffs or you will end up publishing something nonsensical:</p>
<blockquote><pre>This function returns status values as follows:

    CBS_INVARG  requested file name length is too int</pre></blockquote> ]]></content:encoded>
		<dc:subject>default</dc:subject>
		<dc:date>2010-07-04T10:29:00-04:00</dc:date>
    </item>

</channel>
</rss>