[wdmaudiodev] Re: AVStream driver & globally allocated memory

  • From: "alexander ivash" <elderorb@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Mon, 20 Jun 2016 22:22:49 +0300

Tim Roberts <timr@xxxxxxxxx> писал(а) в своём письме Mon, 20 Jun 2016 20:47:30 +0300:

In an AVStream driver, there are three layers in the hierarchy:
    - Device
    - Filter
    - Pin

I understand this, but I failed to find 'Device context' (is it device extension?) so decided to 'simulate' it by creating real global variable. And yes, I manage memory by myself in such a case.

Your "global" data should be contained in the appropriate context
structure.  Data that applies to all filters for the current device
instance should be member variables in CCaptureDevice.  That way, YOU
don't have to worry about allocation at all.  The memory gets managed by
AVStream and added to the memory "bag", so it can get automatically
deallocated when the device is destroyed.

Unfortunately there is no CCaptureDevice in my 'avssamp' sample. That's why global variables.

gets called once, and DriverUnload gets called once.  That's a
contract.  You'd added debug prints to make sure that statement is
holding true?

Yes, that's the case. And as I said, I found the reason for BSOD. But would still like to adjust code to follow the best practices using device context. Just need to figure out what this context is and how to put data into it.

Regards, Alexander

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx


Other related posts: