This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM8168 dvr_rdk audio stream (uLaw) problem

Other Parts Discussed in Thread: TVP5158

Hello friends, I'll would be very glad if anyone can help me fix very strange problem with audio, when audio streammed via RTP.

I works with DVR-RDK V02.00.00.24 on DM8168 board. My board capture 16 channels of video and audio (microphone) via TVP5158 encoders (4 chips on board), encode it to H264 and uLaw accordingly and stream by wis-streammer (live555 based). For my test (for recreate the problem) used only single microphone connected to the board without any connected video cameras, so this isn't performance (CPU load) problem. After time ~65...70 min. I saw that my streammer stop get encoded audio data from encoder. Reason - frame with requested serial number is absent in memory manager: MemMng_GetFrameBySerial() return error - "search no frame". After the analysis of contents of blocks of memory I saw that really, frame with requested serial number is absent in memory storage. This problem occured bacause stream writer make wraparound on memory storage and start overwrite "old" frames" requested by streammer.

This is fragment of my logs:

=====================================================================================================

MemMng_GetFrameBySerial() frame found. serial = 40292, cnt = 100, ts = 4900064

4914966   MemMng_GetFrameBySerial (40292, 0xd25c4c) return 0xdf33b0 [cache_mng.c.765]

4914966   getAudioData() return 1920 bytes Time between requests = 120 [max_time = 144] IPC time = 1           .

4915075   AUDIO_streamShmCopy() status = 0, data size = 1920, frameCnt = 40420 [time delta = 1]

4915086   call getAudioData() MemMng_GetFrameBySerial() frame found. serial = 40293, cnt = 101, ts = 4900192

4915087   MemMng_GetFrameBySerial (40293, 0xd25c4c) return 0xdf348c [cache_mng.c.765]

4915087   getAudioData() return 1920 bytes Time between requests = 121 [max_time = 144] IPC time = 1           .

4915171   AUDIO_streamShmCopy() status = 0, data size = 1920, frameCnt = 40421 [time delta = 0]

4915205  call getAudioData() MemMng_GetFrameBySerial() frame found. serial = 40294, cnt = 102, ts = 4900319

4915206   MemMng_GetFrameBySerial (40294, 0xd25c4c) return 0xdf3568 [cache_mng.c.765]

4915206   getAudioData() return 1920 bytes Time between requests = 119 [max_time = 144] IPC time = 1           .

4915299   AUDIO_streamShmCopy() status = 0, data size = 1920, frameCnt = 40422 [time delta = 0]

4915326   call getAudioData() MemMng_GetFrameBySerial() frame found. serial = 40295, cnt = 103, ts = 4900447

4915326   MemMng_GetFrameBySerial (40295, 0xd25c4c) return 0xdf3644 [cache_mng.c.765]

4915326   getAudioData() return 1920 bytes Time between requests = 121 [max_time = 144] IPC time = 0           .

4915426   AUDIO_streamShmCopy() status = 0, data size = 1920, frameCnt = 40423 [time delta = 0]

4915445   call getAudioData() MemMng_GetFrameBySerial() frame found. serial = 40296, cnt = 104, ts = 4900544

4915446   MemMng_GetFrameBySerial (40296, 0xd25c4c) return 0xdf3720 [cache_mng.c.765]

4915446   getAudioData() return 1920 bytes Time between requests = 119 [max_time = 144] IPC time = 1           .

4915500   AUDIO_streamShmCopy() status = 0, data size = 1920, frameCnt = 40424 [time delta = 0]

4915501   AUDIO_streamShmCopy() status = 0, data size = 1920, frameCnt = 40425 [time delta = 0]

4915524   AUDIO_streamShmCopy() status = 0, data size = 1920, frameCnt = 40426 [time delta = 1]

4915565   call getAudioData() MemMng_GetFrameBySerial() Search no frame. serial = 40297, pVidInfo->frame_num = 256, cnt = 256 [mem_mng.c.1019]

=====================================================================================================

 

From this log: when streammer request audio frame with serial number 40297, encoder already erase this frame and put the audio frame with serial number 40426, and "oldest" frame stored in memory has serial number 40298. In other words - wraparound on memory

 

This is fragment of memory storage contains:

======================================================================================================

.................

0100:  serial = -1, fram_type = -1, timestamp = 0, blkindex = -1, blks = -1, realsize = -1, flag = 0

0101:  serial = -1, fram_type = -1, timestamp = 0, blkindex = -1, blks = -1, realsize = -1, flag = 0

0102:  serial = -1, fram_type = -1, timestamp = 0, blkindex = -1, blks = -1, realsize = -1, flag = 0

0103:  serial = -1, fram_type = -1, timestamp = 0, blkindex = -1, blks = -1, realsize = -1, flag = 0

0104:  serial = -1, fram_type = -1, timestamp = 0, blkindex = -1, blks = -1, realsize = -1, flag = 0

0105:  serial = -1, fram_type = -1, timestamp = 0, blkindex = -1, blks = -1, realsize = -1, flag = 0

0106:  serial = 40298, fram_type = 0, timestamp = 4900799, blkindex = 212, blks = 2, realsize = 1920, flag = 0

0107:  serial = 40299, fram_type = 0, timestamp = 4900927, blkindex = 214, blks = 2, realsize = 1920, flag = 0

0108:  serial = 40300, fram_type = 0, timestamp = 4901024, blkindex = 216, blks = 2, realsize = 1920, flag = 0

0109:  serial = 40301, fram_type = 0, timestamp = 4901152, blkindex = 218, blks = 2, realsize = 1920, flag = 0

0110:  serial = 40302, fram_type = 0, timestamp = 4901279, blkindex = 220, blks = 2, realsize = 1920, flag = 0

0111:  serial = 40303, fram_type = 0, timestamp = 4901407, blkindex = 222, blks = 2, realsize = 1920, flag = 0

0112:  serial = 40304, fram_type = 0, timestamp = 4901504, blkindex = 224, blks = 2, realsize = 1920, flag = 0

0113:  serial = 40305, fram_type = 0, timestamp = 4901632, blkindex = 226, blks = 2, realsize = 1920, flag = 0

0114:  serial = 40306, fram_type = 0, timestamp = 4901760, blkindex = 228, blks = 2, realsize = 1920, flag = 0

................

======================================================================================================

I don't understand why this problem is occured, but I assume that the reasons can be the following:

1) wis-streammer requests data more slowly than it is necessary (but because only single microphone connected to the board without any video I think its not performance problem). getAudioData() always return 1920 bytes that exact value for 120 msec. of encoded audio.

2) encoder perform the capture of microphone, audio encode and put encoded data to memory storage more quickly than it is necessary. I thought that there could be a problem in PLL's settings, but McASP capture the microphone via TVP5158 encoder and so works as slave - clock supplied by TVP5158 (it's correct?).

 

Please let me know how I can to fix the porblem, what I can to do?

I will be grateful for any your help.