Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

PlantUML Macro
formatSVG
titleNetflix to Rialto Client
@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

...

PlantUML Macro
formatSVG
titlePushing data to Gstreamer server pipeline
@startuml

autonumber

box "Platform" #LightGreen
participant rialtoClient
end box

box "Platform" #LightBlue
participant rialtoServer
participant GStreamer_server
participant Ocdm
end box

note across
Gstreamer app source uses 2 signals, need-data and enough-data,
to notify its client whether it needs more data. Rialto server
should only push data when the appsrc indicates that it is in
the need-data state.
end note


loop While appsrc needs data && appsrc data available in shm buffer

rialtoServer       ->  rialtoServer:      Extract frame's metadata from shm
opt Frame encrypted

opt media_keys.key_system == "com.netfliux.playready"
rialtoServer       ->  Ocdm:              opencdm_select_key_id(ocdm_session, kid)
end

rialtoServer       ->  Ocdm:              opencdm_gstreamer_session_decrypt(ocdm_session, gst_buffer, subsample_info, iv, key, init_with_last_15)
end

rialtoServer       ->  GStreamer_server:  gst_app_src_push_buffer(src, gst_buffer)
rialtoServer       ->  rialtoServer:      'Remove' frame from shm

opt First video frame pushed at start of playback / after seek
note across: Not currently implemented
rialtoServer       --/ rialtoClient:      notifyFrameReady(frame_timestamp)
end

opt Appsrc data exhausted from shm
opt (status == EOS) for this appsrc
rialtoServer       ->  GStreamer_server:      notify EOS
else Not EOS
rialtoServer       --/ rialtoClient:      notifyNeedMediaData(...)
end
end

end

@enduml

...