Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.6 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1999, 2000 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: fwdserver.cpp
  6. * Content: Implements the forwarding server portion of the server class
  7. *
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 11/01/2000 rodtoll Split out from dvsereng.cpp
  12. *
  13. ***************************************************************************/
  14. #include "dxvoicepch.h"
  15. #undef DPF_MODNAME
  16. #define DPF_MODNAME "CDirectVoiceServerEngine::StartupMulticast"
  17. //
  18. // StartupMulticast
  19. //
  20. // This function is called to initialize the multicast portion of the server
  21. // object.
  22. //
  23. // Called By:
  24. // - StartSession
  25. //
  26. // Locks Required:
  27. // - None
  28. //
  29. HRESULT CDirectVoiceServerEngine::StartupMulticast()
  30. {
  31. return DV_OK;
  32. }
  33. #undef DPF_MODNAME
  34. #define DPF_MODNAME "CDirectVoiceServerEngine::ShutdownMulticast"
  35. //
  36. // ShutdownMulticast
  37. //
  38. // This function is called to shutdown the multicast portion of the server
  39. // object.
  40. //
  41. // Called By:
  42. // - StartSession
  43. //
  44. // Locks Required:
  45. // - None
  46. //
  47. HRESULT CDirectVoiceServerEngine::ShutdownMulticast()
  48. {
  49. return DV_OK;
  50. }
  51. HRESULT CDirectVoiceServerEngine::HandleForwardingReceive( CVoicePlayer *pTargetPlayer, PDVPROTOCOLMSG_SPEECHWITHTARGET pdvSpeechWithtarget, DWORD dwSpeechSize, PBYTE pbSpeechData )
  52. {
  53. HRESULT hr;
  54. PDVTRANSPORT_BUFFERDESC pBufferDesc;
  55. PDVPROTOCOLMSG_SPEECHWITHFROM pdvSpeechWithFrom;
  56. PVOID pvSendContext;
  57. DWORD dwTransmitSize = sizeof( DVPROTOCOLMSG_SPEECHWITHFROM ) + dwSpeechSize;
  58. DNASSERT( dwTransmitSize <= m_lpdvfCompressionInfo->dwFrameLength + sizeof( DVPROTOCOLMSG_SPEECHWITHFROM ) );
  59. pBufferDesc = GetTransmitBuffer( dwTransmitSize, &pvSendContext );
  60. if( pBufferDesc == NULL )
  61. {
  62. DPFX(DPFPREP, DVF_ERRORLEVEL, "Error allocating memory" );
  63. pTargetPlayer->Release();
  64. return FALSE;
  65. }
  66. pdvSpeechWithFrom = (PDVPROTOCOLMSG_SPEECHWITHFROM) pBufferDesc->pBufferData;
  67. pdvSpeechWithFrom->dvHeader.dwType = DVMSGID_SPEECHWITHFROM;
  68. pdvSpeechWithFrom->dvHeader.bMsgNum = pdvSpeechWithtarget->dvHeader.bMsgNum;
  69. pdvSpeechWithFrom->dvHeader.bSeqNum = pdvSpeechWithtarget->dvHeader.bSeqNum;
  70. pdvSpeechWithFrom->dvidFrom = pTargetPlayer->GetPlayerID();
  71. memcpy( &pdvSpeechWithFrom[1], pbSpeechData, dwSpeechSize );
  72. hr = m_lpSessionTransport->SendToIDS( (PDVID) &pdvSpeechWithtarget[1], pdvSpeechWithtarget->dwNumTargets, pBufferDesc, pvSendContext, 0 );
  73. if( hr == DVERR_PENDING )
  74. {
  75. hr = DV_OK;
  76. }
  77. else if( FAILED( hr ) )
  78. {
  79. DPFX(DPFPREP, DVF_ERRORLEVEL, "Failed sending to ID hr=0x%x", hr );
  80. }
  81. return hr;
  82. }