DDVTECH / mistserver

The official mistserver source repository - www.mistserver.com
The Unlicense
385 stars 133 forks source link

[bug] MistSession creating many many audio tracks #180

Open iameli opened 1 year ago

iameli commented 1 year ago

Weird one.

Version is this:

Version: 777e2ab2cb3449ed3c7398a9c4b9e57b77b2e085, release Generic_x86_64
Built on Aug  2 2023, 11:34:55

Xeenon is having an issue where they keep getting more and more AAC audio tracks get created, eventually hitting the cap at 99 and causing problems. Here's the MistUtilRAX output with 98 audio tracks. [Update: this looks to have been truncated by Discord. There were 99 in there and they all looked like that.]

The video track in there is being produced by MistOutRTMP. The excessive audio tracks appear to be all coming from MistSession instances; for example we see

        #3:
          codec: AAC
          encryption: 
          id: 255
          ivec: 0
          lastupdate: 199526
          minkeepaway: 200
          page: MstTrakstream+64d3ccea2667b39508df6263@2189221-3
          pid: 2189221
          playready: 
          sourcetid: 1
          type: audio
          valid: 0
          widevine: 

And that seems to be a MistSession process:

root@livepeer-catalyst-0:/app# ps aux | grep 2189221
root     2189224  0.2  0.0  33012 12960 ?        S    17:30   0:00 /usr/local/bin/MistSession O893156aa078decaf995d8ad160aa33f66d8c34110cbdfff3bf477cf9c009d350 --streamname stream+64d3ccea2667b39508df6263 --ip :: --tkn 2189221

Unclear to me why MistSession would create a track. Whatever's happening, it definitely results in replication failures:

[2023-08-09 18:23:32] MistInDTSC:stream+64d3d7762667b39508dfeeec (17055) INFO: Page MstMetastream+64d3d7762667b39508dfeeec not found (../lib/dtsc.cpp:1149) 
[2023-08-09 18:23:32] MistInDTSC:stream+64d3d7762667b39508dfeeec (17055) INFO: No track pointer, not refreshing. (../lib/dtsc.cpp:1228) 
[2023-08-09 18:23:32] MistInDTSC:stream+64d3d7762667b39508dfeeec (17055) FAIL: Could not open stream metadata to merge in remote tracks; aborting! (../src/input/input_dtsc.cpp:177) 
[2023-08-09 18:23:32] MistInDTSC:stream+64d3d7762667b39508dfeeec (17055) INFO: Shared metadata not ready yet - no tracks valid (../lib/dtsc.cpp:2192) 
[2023-08-09 18:23:32] MistInDTSC:stream+64d3d7762667b39508dfeeec (17055) WARN: Input closing unclean, reason: Could not open stream metadata to merge in remote tracks (../src/input/input.cpp:783)

The only other detail I have is that there were some failing STREAM_BUFFER triggers that were set to blocking. Presumably that should do nothing, as blocking STREAM_BUFFER is ignored. But it was the only thing that jumped out at me so I figured I'd include it for completeness even if it's a red herring.

transmental commented 1 year ago

seems the issue was caused by using # "audio_select": "all", in our configuration

we have switched the config to none and added -> "streams": { "stream": { "name": "stream", "processes": [ { "codec":"AAC", "exit_unmask": False, "process": "FFMPEG", "source_mask": "4", "source_track": "surround", "target_mask": "255", "track_inhibit": "audio=mono,stereo", "x-LSP-kind": "audio", "x-LSP-name": "Surround downmix to stereo", },

transmental commented 1 year ago

we are now experiencing issues with increasingly many H264 tracks.

RelAccX: 1 x 190061b @153 (#0 - #0) Field bootmsoffset: int (8) Field bufferwindow: uint (8) Field live: uint (1) Field maxkeepaway: uint (2) Field minfragduration: uint (8) Field resume: uint (1) Field source: string (512) Field tracks: nested RAX (189448) Field utcoffset: int (8) Field uuid: string (64) Field vod: uint (1)

0:

bootmsoffset: 471624110
bufferwindow: 80803
live: 1
maxkeepaway: 45000
minfragduration: 2083
resume: 0
source: push://INTERNAL_ONLY:dtsc://prod-fra.livepeer-catalyst-0.xeenon.xyz:----
tracks: Nested RelAccX:
  RelAccX: 100 x 1893b @148 (#0 - #25)
    Field codec: string (32)
    Field encryption: string (256)
    Field id: uint (4)
    Field ivec: uint (8)
    Field lastupdate: uint (8)
    Field minkeepaway: uint (8)
    Field page: string (256)
    Field pid: uint (4)
    Field playready: string (1024)
    Field sourcetid: uint (4)
    Field type: string (32)
    Field valid: uint (1)
    Field widevine: string (256)
    #0:
      codec: AAC
      encryption: 
      id: 1
      ivec: 0
      lastupdate: 471984
      minkeepaway: 360
      page: MstTrakstream+64d7f88cedf2e2ce80cf9320@3146954-0
      pid: 3146954
      playready: 
      sourcetid: 4294967295
      type: audio
      valid: 255
      widevine: 
    #1:
      codec: H264
      encryption: 
      id: 2
      ivec: 0
      lastupdate: 471984
      minkeepaway: 200
      page: MstTrakstream+64d7f88cedf2e2ce80cf9320@3146954-1
      pid: 3146954
      playready: 
      sourcetid: 4294967295
      type: video
      valid: 255
      widevine: 

...

24:

      codec: H264
      encryption: 
      id: 41
      ivec: 0
      lastupdate: 471976
      minkeepaway: 0
      page: MstTrakstream+64d7f88cedf2e2ce80cf9320@3146954-24
      pid: 3146954
      playready: 
      sourcetid: 4294967295
      type: video
      valid: 255
      widevine: 
    #25:
      codec: H264
      encryption: 
      id: 42
      ivec: 0
      lastupdate: 471976
      minkeepaway: 0
      page: MstTrakstream+64d7f88cedf2e2ce80cf9320@3146954-25
      pid: 3146954
      playready: 
      sourcetid: 4294967295
      type: video
      valid: 255
      widevine: 
utcoffset: 0
uuid: 6e134606-0208-4d0a-bdbb-5eaed42448d0
vod: 0