@startuml
autonumber
box "Container" #LightGreen
participant Netflix
participant DPI
participant rialtoClient
end box
rialtoClient -/ DPI: notifyNeedMediaData(pipeline_session, sourceId, frame_count, need_data_request_id, shm_info)
DPI --> rialtoClient:
opt Cached segment stored from previous need data request
DPI -> rialtoClient: addSegment(need_data_request_id, cached_media_segment)
rialtoClient --> DPI: status
note right: status!=OK should never happen here
end
loop While (frames_written < frame_count) && (addSegment() returns OK) && (get_next_media_sample_status == OK)
DPI -/ Netflix: getNextMediaSample(es_player, sample_writer)
Netflix -> DPI: initSample(sample_writer, sample_attributes)
DPI -> DPI: Cache sample_attributes
DPI --> Netflix: status
Netflix -> DPI: write(sample_writer, data)
DPI -> DPI: Create MediaSegment object from data and cached\nsample_attributes (including any decryption attributes)
DPI -> rialtoClient: addSegment(need_data_request_id, media_segment)
opt Encrypted content && key session ID present in map (see Select Key ID)
rialtoClient -> rialtoClient: Set key_id in media_segment to value\nfound in map for this key session ID
note left: MKS ID should only be found in map for Netflix content
end
rialtoClient --> DPI: status
opt status==NO_SPACE
DPI -> DPI: Cache segment for next need data request
note right
This will require allocating temporary
buffer to store the media data but this
should happen very rarely in practise.
*TODO:* Consider adding canAddSegment()
Rialto API so that initSample() could
return NO_AVAILABLE_BUFFERS to cancel
this request and avoid the need for
the temporary media data cache.
end note
end
DPI --> Netflix: write_status
Netflix --> DPI: get_next_media_sample_status
end
opt get_next_media_sample_status == OK
DPI -> DPI: have_data_status = OK
else get_next_media_sample_status == NO_AVAILABLE_SAMPLES
DPI -> DPI: have_data_status = NO_AVAILABLE_SAMPLES
else get_next_media_sample_status == END_OF_STREAM
DPI -> DPI: have_data_status = EOS
else
DPI -> DPI: have_data_status = ERROR
end
DPI -> rialtoClient: haveData(pipeline_session, have_data_status, need_data_request_id)
opt Data accepted
opt Frames pushed for all attached sources && buffered not sent
rialtoClient -/ DPI: notifyNetworkState(NETWORK_STATE_BUFFERED)
end
rialtoClient --> DPI: OK
else Errror
rialtoClient --> DPI: ERROR
rialtoClient -/ DPI: notifyPlaybackState(PLAYBACK_STATE_FAILURE)
end
opt First video frame at start of playback or after seek ready for rendering
opt notifyFrameReady not currently implemented
rialtoClient -/ DPI: notifyFrameReady(time_position)
else
rialtoClient -/ DPI: notifyPlaybackState(PLAYBACK_STATE_PAUSED)
end
DPI -/ Netflix: readyToRenderFrame(pts=time_position)
end
@enduml |