This document was generated from CDN thread Created by: Pavel Richter on 03-06-2013 10:17:16 AM Hello to everybody,I try make TSP Media Driver application. I can record wav file by EpStreamWrite. But I can't take data from opposite direction. Trace function return:epInit, level:3, data: clRtpStream Open 0x01425520 Type: 1 IPL: 192.168.254.227:21100 IPR: (null)epInit, level:3, data: clRtpStream::Start ok (IN) socket (0x1b0) CODEC IN: 0x7 OUT: 0x7epInit, level:3, data: sock: 0x1b0 192.168.254.227:21100 AF_INET SOCK_DGRAM IPPROTO_UDPepInit, level:4, data: SockAddrToString: error 10022 while converting ???epInit, level:3, data: sock: 0xffffffff (null) AF_UNSPEC SOCK_??? IPPROTO_???...epInit, level:4, data: RTP Rx: First Packet.epInit, level:4, data: RTP Rx: invalid sequence nbr?epInit, level:4, data: RTP Rx: invalid sequence nbr?epFuncReadepInit, level:4, data: ~clRtpStream this=014231A8 type=Out RTP pkts: get=1 allocated=2Is there any sample application that uses EpStreamRead?Thanks for all suggestionsPavelSubject: RE: EpStreamRead problem Replied by: Antonio Sedano on 11-06-2013 05:51:16 AMI hope this can help you. 1void CTspMediaDriverMfcDlg::OnBnClickedBtReadwave()
2{
3 LONG lRet;
4 varStrDevID.dwTotalSize = sizeof (VARSTRING) + 1024;
5 lRet = lineGetID(lphLine,0,NULL,LINECALLSELECT_LINE,&varStrDevID,L"ciscowave/in");
6 dwDeviceId = ((DWORD *) (((BYTE *) &varStrDevID) + varStrDevID.dwStringOffset))[0];
7 hinsDLL = LoadLibrary(L"ciscortplib.dll");
8 if(!EpInit(EscribirTrace,21100,500,0,0))
9 {
10 this->m_edit1.SetWindowTextW(L"Error in _EpApiInit");
11 }
12 Sleep(1000);
13 CCiscoLineDevSpecificSetStatusMsgs _statusMsg;
14
15 _statusMsg.m_DevSpecificStatusMsgsFlag = SLDST_SET_STATUS_MESSAGES;
16
17 hResult = lineDevSpecific(lphLine,0,NULL,_statusMsg.lpParams(),_statusMsg.dwSize());
18 if(hResult<0)//error
19 {
20 CString sTrace;
21 char trace[100];
22 sprintf_s(trace,100, "Error %x",lRet);
23 sTrace = trace;this->m_edit1.SetWindowTextW(sTrace);
24 }
25
26
27 LINEMESSAGE msg;
28 DWORD CiscoMessageType = -1;
29 int i = 0;
30 do{
31 ULONG bLGM = lineGetMessage(m_hLineApp,&msg,5000);
32 CiscoMessageType = msg.dwParam1 & 0x000000FF;
33 i++;
34 if(msg.dwMessageID == LINE_DEVSPECIFIC)
35 {
36 i =i;
37 }
38 }while(msg.dwMessageID != SLDSMT_START_RECEPTION && i < 10) ;
39 //SLDSMT_START_RECEPTION ==3,SLDSMT_MONITORING_ENDED == 12
40 Sleep(2000);
41 EpOpenId = (OpenById)GetProcAddress(hinsDLL,"_EpOpenById");
42 hdOpen = EpOpenId(dwDeviceId,ToApp);//(PRTPENDPOINTCALLBACK)EndPointCallback0);
43
44
45 hdGSH = EpGetStreamHandle(hdOpen,STREAM_TYPE_AUDIO,ToApp);
46
47 bool bss2 = EpStreamStart(hdGSH);//(PRTPENDPOINTCALLBACK)EndPointCallback1);
48
49 memset(sFile,0,iFileSize+1);
50 for (int x=0;x<500;x++)
51 {
52 bool bSW = EpStreamRead(hdGSH,sFile,iFileSize,(PVOID)"EpStreamRead",EndPointCallback0);
53 }
54 Sleep(10000);
55 bool bStrmStop = EpStreamStop(hdGSH);
56 bool bClose = EpClose(hdOpen);
57}
58extern "C" void WINAPI EndPointCallback0(HANDLE hEp, HANDLE hStream, DWORD dwError,PUCHAR pData, DWORD dwBytes, LPVOID pUser,bool isSilence, StreamDirection direction)
59{
60 if(strcmp((char *)pUser, "EpStreamRead")==0)
61 {
62 FILE *fp;fp=fopen("c:\\temp\\fich1.txt","ab");
63 if (fp==NULL)
64 {
65 fp=fopen("c:\\temp\\fich1.txt","wb");
66 }
67
68 fwrite(pData,dwBytes,1,fp);
69 fclose(fp);
70 }
71}
After running this code you should have c:\\temp\\fich1.txt with datas. To convert this txt in a wave you have to decrypt using RC4
Regards.
Subject: RE: EpStreamRead problem Replied by: Pavel Richter on 01-07-2013 02:13:33 AMThank you for your replay. I moved next call EpStreamRead to EndPointCallback0. It's ok, but I have next minor problem.If my program runs in virtual platform on debug mode (I'm writing some information to log file) or if virtual is under load, EpStreamRead returns old data. I try to call EpStreamRead in for cycle like in your example, with same result . Data returned by EpStreamRead have some time delay. This delay was lineary increasing. Delay is 1-3s per minute. EpStreamRead can manage data in time. I try to add Sleep(10) to EndPointCallback0 or remove loging from this function. EpStreamRead even returns old data (with delay), and delay is same. Thanks in advance for any respons or ideas.