Confusion over RecordingSession.elementaryStreamsToPidMapTable()
I'm trying to understand how this function works, and more importantly what it is meant to acheive.
It seems that given a bunch of of ElementaryStreamExt [streams] it then creates another bunch of PidMapEntry in a PidMapTable.
My question relates to the addition of the PCR stream.
There is a test to see if one of the entries in details [not the parameter streams which is used as a size parameter to the PidMapTable] has the same PID as the details PcrPID. If the PIDs match the pcrComponent is assigned to that component. Aside from repeated calls to details.getPcrPID(), which makes an asynchronous call to the SI Database, this seems reasonable.
Now, having found the PID of the PCR a final entry is added to the PidMapTable, but this still takes the stream type of the source component [and is not and cannot be MediaStreamType.PCR as there is no way to generate this value through PidMapEntry.streamTypeToMediaStreamType()] so that means the added PidMapEntry is of the type of the last component that had the same PID as the PCR. Therefore we could have a video stream type that is the genuine video and another video that is the same as the PCR pid, or a video stream type and an unknown type that is supposed to be the PCR.
So the question is, how do we actually get the PCR PID into the PidMapTable for use later on by decodeRecording() ?