|
|
Comments and Discussions
|
|
 |

|
Thanks for the sample! I'm learning a lot! Were you able to figure out how to get DXVA Hardware Decoding running on this?
|
|
|
|

|
Yes you can configure and use DXVA2 decoding with that sample.
|
|
|
|

|
Hallo Maxim,
first at all: thank you for that great piece of code .
I got a little Problem with it: I tried to use the code for a tiny media-player which plays a 10sec. media file (DNxHD Codec - LAV Splitter as decoder...) in a loop, but it doesn`t run very long until it consumes a huge ammount of memory.
I also reproduced this behaviour with your sample application, do you have any idea?
Best regards,
Andi
|
|
|
|

|
Not sure that your memory leaks related to my code - as you can see in there I allocate fixed number of render targets and use them along playback - so memory allocation perfomed one time.
Try use other spliters or decoders in your playback probably issue is in there. Try to reproduce graph in GraphEdit.
Maxim.
|
|
|
|

|
Thank you for your fast reply. As you say, maybe it`s not in your code: i tried it out with GraphEdit, and it also leaks, but only if I use EVR as renderer not with VMR.
The funny thing: First at all I wanted to use the WMP-OCX but this also leaks badly - and seemingly ther`s no solution for that (there are many other guys having the same problem with WMP-OCX...).
So for me the only solution which doesn`t leak is rendering with Quartz and VMR, but this has some side effects in conjunction with Windows 7s Aero (if Aero is turned on, the interpolation is ugly if the video resolution doesn`t match screen resolution exactly).
Andi
|
|
|
|

|
Try to unregister one by one the filter used by default for your file playback, so graph manager will be using other ones instead of them and you will figure onu which filter eat memory.
Maxim.
|
|
|
|
|

|
Thank you for excellent example code.
I want to play h264 or wmv with DXVA2 decoder.
This code use EVR, but DXVA2 decoder device was not created,
using software decoder(checked with DXVA_checker_2.9.1).
DXVA2 decoder device was created when I use GraphEdit player,
using same filter graph.(checked m_playback[n].name)
Is any solution known?
|
|
|
|

|
hello,
How are you determine if dxva2 used or not?
dxva used in case if the decoder uses it. If decoder supports dxva it usually query for upstream filter Direct3D device. And create query caps and the allocator based on it. I didn't check dxva in that sample so I can only suggest you to figure that.
Following things will help you find the solution:
Check if the connected decoder supports dxva2.
Check device creation settings - maybe necessary to change configuration in there.
Check media types negotiations as in sample is uses swap chains, maybe better to change that with dxva surface and other formats and performs blitting to a target surface before render.
Regards,
Maxim.
|
|
|
|

|
Thank you for reply.
For determine if DXVA2 use or not, I used DXVA checker's Trace log.
http://bluesky23.yu-nagi.com/en/DXVAChecker.html[^]
I checked mp4(avc) file with below filter graph.
source(mp4/avc) -> Haali Splitter ->Microsoft DTV-DVD Decoder -> EVR
Graphedit trace log
DXVA2_DecodeDeviceCreated, graphedt, 00:00:02.2734124
DXVA2_DecodeDeviceBeginFrame, graphedt, 00:00:02.3222269
DXVA2_DecodeDeviceGetBuffer, graphedt, 00:00:02.3224265
DXVA2_DecodeDeviceGetBuffer, graphedt, 00:00:02.3224391
DXVA2_DecodeDeviceExecute, graphedt, 00:00:02.326083
created dxva2 bob device,processor device, and ModeH264_VLD_NoFGT(DXVA2 decoder device).
EVRPlayback trace log(same mp4 source, and same filter-graph)
DXVA2_ProcessDeviceCreated, EVRPlayback.vshost, 00:00:06.0879228
DXVA2_ProcessDeviceCreated, EVRPlayback.vshost, 00:00:06.0880062
DXVA2_ProcessBlt, EVRPlayback.vshost, 00:00:06.0908226
DXVA2_ProcessBlt, EVRPlayback.vshost, 00:00:06.1158033
DXVA2_ProcessBlt, EVRPlayback.vshost, 00:00:06.1163385
DXVA2_ProcessBlt, EVRPlayback.vshost, 00:00:06.1290979
created dxva2 bob device and processor device.
Although a part of dxva2 functions are used, it use software decoder.
I would like to know whether EVRPlayback can use dxva2 decoder.
I guess it is necessary to implement some additional interfaces( IDirectXVideoDecoderService,
IDirectXVideoAccelerationService..)
|
|
|
|

|
Hi,
Not sure in that necessary to make that interfaces. Maybe expose them over GetService.
Try to research in things I listed in previous reply.
Regards,
Maxim.
|
|
|
|

|
Hi,
I am facing tough problem out here. We had to switch from VMR9 to EVR for performance and quality reasons.
When we play large .ts files, and move slider 3-4 times, entire app hangs. Same thing happened even on GraphEdit.
Video Decoder : AVC H264,
Audio Decoder : AAC
please help
|
|
|
|

|
This can be bcs of one of the following issues: mpeg spliiter used is not good or H264 decoder is not good. Send me your GraphEdit screen shots. Try to use ffdshow decoder - it's works on CPU but decoding properly in most cases, also try DivX H264 Decoder, for splitter try MPC Splitter. Also you can try to play your file in MPC as I remember it allows to try different renderers.
Regards,
Maxim.
|
|
|
|

|
This is a nice article. You are right that Debug and Trace stuff takes a global lock thus hurting performance but if you are writing it via OutputDebugString and you have a listener attached to it (the debugger or DbgView) it is much slower anyway.
At least it is much slower than to write directly to a file. In your next article you mention TRACE_ENTER which uses Reflection whic is veery slow. Much slower than to take a lock. There are ways to improve perf via using GetStackFramesInternal or by passing the method name as plain string.
In fact I have written a tracing library here which should suit your perf needs.
You seem to have written your own SynchronizationContext class implementation. I think it should be possible to set for the threads that require marshalling your own derived Synchronization context class and use this for marshalling.
Yours,
Alois Kraus
|
|
|
|

|
Hi,
Sure any debugging stuff slow down the performance either in .NET or in native code. But that is only for testing purpose and in DEBUG build. Writing directly to a file is slower than using OutputDebugString. Reflection not so slow as usage Debug and Trace classes and works fine but sure necessary to think there to put it in code and remove once it not required.
Yes in here implemented common context thread stuff, but with some modifications with COM marshaling it can be removed but then will be bit harder for testing.
Maxim.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
Articles describes how to make pure C# rendering video on EVR with custom presenter over Direct3D in .NET
| Type | Article |
| Licence | CPOL |
| First Posted | 11 Jul 2012 |
| Views | 8,353 |
| Downloads | 845 |
| Bookmarked | 13 times |
|
|