Player-NLC Remote Video Stream Path (Read/Seek)¶
Scope¶
This document covers only the path where media is streamed from a remote peer into Player-NLC using file-transfer streaming semantics (remote read, seek, stream control).
It does not cover camera-live MJPEG broadcast paths.
Entry Path: GUI -> Player-NLC Stream Mode¶
- A stream asset is launched via Player-NLC.
AppletPlayerNlcBase::playAsset(...)checksassetInfo.isStream()and routes toplayStream(...).-
AppletPlayerNlcBase::playStream(...)starts two coordinated paths: -
GetVirtStreamMgr().fromGuiPlayStream(...)to initialize virtual remote file state. IMediaPlayerRequests::getNlcPlayer().fromGuiPlayStream(...)to start the player module in stream mode.
Code:
Stream Session Setup¶
VirtStreamMgr::fromGuiPlayStream(...) prepares the stream session:
- Copies stream asset metadata into
m_LiveStreamand forcesisStream=true. - Stores local session id.
- Resolves best connection to the remote owner (
assetInfo.getDestUserId()). - Registers for file-transfer callbacks.
- Calls
PluginFileShareClient::startStream(...).
PluginFileShareClient::startStream(...) converts the asset to FileInfo (stream=true) and starts transfer via FileInfoXferMgr::startDownload(...).
Code:
- nolimitgui/src/VirtStream/VirtStreamMgr.cpp
- libs/libptopengine/Plugins/PluginFileShareClient.cpp
- libs/libptopengine/Plugins/FileInfoXferMgr.cpp
Remote Read Path¶
The player reads via virtual file APIs; the stream manager serves bytes from remote-fed caches.
1) Virtual file open¶
VirtStreamMgr::fileOpen(...)selects virtual stream handling.VirtStreamMgr::virtFileOpen(...)validates requested file name against active stream asset and createsm_LiveStream.m_VFilewith logical file length.
Code:
2) Virtual read¶
VirtStreamMgr::fileRead(...)dispatches tovirtFileRead(...)for virtual stream files.virtFileRead(...):- Computes
readAttemptLenbased on file length and current offset. - Calls
waitForStream(fileOffs, readAttemptLen). - Reads bytes from
m_FileTailfirst (if present), else fromm_StreamCache. - Advances virtual file offset when full read succeeds.
Code:
3) How cache gets filled¶
- Incoming transfer packets are delivered to
VirtStreamMgr::onFileXferPktRxed(...). PKT_TYPE_FILE_CHUNK_REQis handled byonPktFileChunkReq(...)and written intom_StreamCacheat packet chunk offsets.- Optional tail data arrives as
PKT_TYPE_STREAM_CTRL_REPLYwitheStreamReadTailand is written intom_FileTail.
Code:
Remote Seek Path¶
1) User seek from Player-NLC UI¶
- Slider change triggers
AppletPlayerNlcBase::slotSliderChanged(...). - UI sends seek request to player module with
fromGuiMediaPlayerSeek(sliderPos).
Code:
2) Virtual stream seek decision¶
VirtStreamMgr::virtFileSeek(...)updates logical offset.- If target position is not already in cache/tail, it sends stream control seek:
sendStreamSeek(newPos)- Builds
PktStreamCtrlReqwitheStreamSeek, session ids, asset id, and start offset.
Code:
3) Server-side seek handling¶
- Engine routes
PKT_TYPE_STREAM_CTRL_REQto FileShareServer plugin. FileInfoXferMgr::onPktStreamCtrlReq(...)handleseStreamSeek:- Finds TX session by stream session id.
- Seeks sender file handle to requested offset.
- Updates transfer offset for subsequent chunk sends.
- Sends stream control reply back.
Code:
- libs/libptopengine/P2PEngine/P2PEnginePktHandlers.cpp
- libs/libptopengine/Plugins/PluginFileShareServer.cpp
- libs/libptopengine/Plugins/FileInfoXferMgr.cpp
Stop/End Teardown¶
When playback stops or ends in Player-NLC:
AppletPlayerNlcBase::onPlaybackStopped(...)/onPlaybackEnded(...)callsGetVirtStreamMgr().onPlaybackStopped(...)/onPlaybackEnded(...)when streaming.VirtStreamMgr::onStreamStop()notifies engine and clearsm_LiveStreamstate/caches.
Code:
Packet Types In This Path¶
PKT_TYPE_FILE_GET_REPLY: establishes stream session mapping (client stores server session id).PKT_TYPE_FILE_CHUNK_REQ: carries streamed file chunks into client stream cache.PKT_TYPE_STREAM_CTRL_REQ(eStreamSeek): client requests remote seek.PKT_TYPE_STREAM_CTRL_REPLY(eStreamReadTailand seek reply): server response/control data.
Code: