mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-30 19:26:05 +00:00
[AUDIO]
- Support zero value tags CORE-6890 #comment please retest svn path=/trunk/; revision=59137
This commit is contained in:
@@ -57,6 +57,12 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PVOID Tag;
|
||||
UCHAR Used;
|
||||
}KSSTREAM_TAG, *PKSSTREAM_TAG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG StreamHeaderCount;
|
||||
@@ -65,7 +71,7 @@ typedef struct
|
||||
|
||||
PKSSTREAM_HEADER CurStreamHeader;
|
||||
PVOID * Data;
|
||||
PVOID * Tags;
|
||||
PKSSTREAM_TAG Tags;
|
||||
}KSSTREAM_DATA, *PKSSTREAM_DATA;
|
||||
|
||||
#define STREAM_DATA_OFFSET (0)
|
||||
@@ -208,7 +214,7 @@ CIrpQueue::AddMapping(
|
||||
if (m_TagSupportEnabled)
|
||||
{
|
||||
// allocate array for storing the pointers of the data */
|
||||
StreamData->Tags = (PVOID*)AllocateItem(NonPagedPool, sizeof(PVOID) * StreamData->StreamHeaderCount, TAG_PORTCLASS);
|
||||
StreamData->Tags = (PKSSTREAM_TAG)AllocateItem(NonPagedPool, sizeof(KSSTREAM_TAG) * StreamData->StreamHeaderCount, TAG_PORTCLASS);
|
||||
if (!StreamData->Data)
|
||||
{
|
||||
// out of memory
|
||||
@@ -520,7 +526,6 @@ CIrpQueue::GetMappingWithTag(
|
||||
PKSSTREAM_DATA StreamData;
|
||||
|
||||
/* sanity checks */
|
||||
PC_ASSERT(Tag != NULL);
|
||||
PC_ASSERT(PhysicalAddress);
|
||||
PC_ASSERT(VirtualAddress);
|
||||
PC_ASSERT(ByteCount);
|
||||
@@ -551,7 +556,11 @@ CIrpQueue::GetMappingWithTag(
|
||||
*VirtualAddress = StreamData->Data[StreamData->StreamHeaderIndex];
|
||||
|
||||
// store tag in irp
|
||||
StreamData->Tags[StreamData->StreamHeaderIndex] = Tag;
|
||||
StreamData->Tags[StreamData->StreamHeaderIndex].Tag = Tag;
|
||||
StreamData->Tags[StreamData->StreamHeaderIndex].Used = TRUE;
|
||||
|
||||
// increment header index
|
||||
StreamData->StreamHeaderIndex++;
|
||||
|
||||
// mapping size
|
||||
if (m_Descriptor->DataFlow == KSPIN_DATAFLOW_IN)
|
||||
@@ -571,7 +580,7 @@ CIrpQueue::GetMappingWithTag(
|
||||
m_NumDataAvailable -= StreamData->CurStreamHeader->FrameExtent;
|
||||
}
|
||||
|
||||
if (StreamData->StreamHeaderIndex + 1 == StreamData->StreamHeaderCount)
|
||||
if (StreamData->StreamHeaderIndex == StreamData->StreamHeaderCount)
|
||||
{
|
||||
// last mapping
|
||||
*Flags = 1;
|
||||
@@ -588,9 +597,6 @@ CIrpQueue::GetMappingWithTag(
|
||||
// one more mapping in the irp
|
||||
*Flags = 0;
|
||||
|
||||
// increment header index
|
||||
StreamData->StreamHeaderIndex++;
|
||||
|
||||
// move to next header
|
||||
StreamData->CurStreamHeader = (PKSSTREAM_HEADER)((ULONG_PTR)StreamData->CurStreamHeader + StreamData->CurStreamHeader->Size);
|
||||
}
|
||||
@@ -622,10 +628,11 @@ CIrpQueue::ReleaseMappingWithTag(
|
||||
for(Index = 0; Index < StreamData->StreamHeaderIndex; Index++)
|
||||
{
|
||||
// check if it is the same tag
|
||||
if (StreamData->Tags[Index] == Tag)
|
||||
if (StreamData->Tags[Index].Tag == Tag && StreamData->Tags[Index].Used == TRUE)
|
||||
{
|
||||
// mark mapping as released
|
||||
StreamData->Tags[Index] = NULL;
|
||||
StreamData->Tags[Index].Tag = NULL;
|
||||
StreamData->Tags[Index].Used = FALSE;
|
||||
|
||||
// done
|
||||
return STATUS_SUCCESS;
|
||||
@@ -648,15 +655,17 @@ CIrpQueue::ReleaseMappingWithTag(
|
||||
StreamData = (PKSSTREAM_DATA)Irp->Tail.Overlay.DriverContext[STREAM_DATA_OFFSET];
|
||||
|
||||
// sanity check
|
||||
PC_ASSERT(StreamData->StreamHeaderIndex + 1 == StreamData->StreamHeaderCount);
|
||||
PC_ASSERT(StreamData->StreamHeaderIndex == StreamData->StreamHeaderCount);
|
||||
|
||||
// check if the released mapping is one of these
|
||||
for(Index = 0; Index < StreamData->StreamHeaderCount; Index++)
|
||||
{
|
||||
if (StreamData->Tags[Index] == Tag)
|
||||
if (StreamData->Tags[Index].Tag == Tag &&
|
||||
StreamData->Tags[Index].Used == TRUE)
|
||||
{
|
||||
// mark mapping as released
|
||||
StreamData->Tags[Index] = NULL;
|
||||
StreamData->Tags[Index].Tag = NULL;
|
||||
StreamData->Tags[Index].Used = FALSE;
|
||||
|
||||
// done
|
||||
break;
|
||||
@@ -668,7 +677,8 @@ CIrpQueue::ReleaseMappingWithTag(
|
||||
// therefore if the current mapping is not the searched one, it must have been already
|
||||
// released
|
||||
//
|
||||
PC_ASSERT(StreamData->Tags[Index] == NULL);
|
||||
ASSERT(StreamData->Tags[Index].Tag == NULL);
|
||||
ASSERT(StreamData->Tags[Index].Used == FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user