Versions Compared

Key

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

...

Set Position

The goal of the setPosition() API is to abort the current data being streamed, flush the AV data pipeline and begin streaming from the specified target position as quickly as possible. Note that Rialto's client may call setPosition() whilst a previous seek is in progress and must handle this gracefully, flushing the pipelines and rendering AV from the most recently requested position as soon as possible.

Note that setPosition() may be called by a client before the call to play() to set the start position of playback (default is 0) but this should be processed in the same way.

...

setPosition() can be used only in Rialto C++ interface. Rialto GStreamer uses setSourcePosition for seeking.


PlantUML Macro
formatSVG
titleInitiate SeekSet Position
@startuml

autonumber

box "Container" #LightGreen
participant Cobalt
participant StarboardApplication
participant GStreamer_client
participant rialtoClient
end box

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

note over Cobalt, GStreamer_clientApplication
The Rialto's client should abort any pending needData() requests before calling setPosition and ignore any
needData() requests received before the SEEK_DONE event as they will be stale.
** TODO - document this in the API header file **
end note

Cobalt             ->  Starboard:         SbPlayerSeek2(player, position)
Starboard          ->  GStreamer_client:  gst_element_seek(pipeline, position, GST_SEEK_FLAG_FLUSH)
GStreamer_client   --> Starboard:
StarboardApplication          --> Cobalt:
GStreamer_client   ->  rialtoClient:      setPosition(pipeline_session, position)
rialtoClient       ->  rialtoClient:      clear local cache of any active data requests for pipeline session
rialtoClient       ->  rialtoServer:      setPosition(pipeline_session, position)
rialtoServer       -/  rialtoClient:      notifyPlaybackState(pipeline_session, PLAYBACK_STATE_SEEKING)
rialtoClient       -/  GStreamer_clientApplication:  notifyPlaybackState(pipeline_session, PLAYBACK_STATE_SEEKING)
rialtoServer       ->  rialtoServer:      store position as "target position" for sample fulfilment algorithm
rialtoServer       ->  rialtoServer:      stop sending new need data requests
rialtoServer       ->  rialtoServer:      clear local cache of any active data requests for pipeline session
rialtoServer       ->  rialtoServer:      clear buffered samples for pipeline session
rialtoServer       ->  GStreamer_server:  gst_element_seek(pipeline, position, GST_SEEK_FLAG_FLUSH)

note left
Use of the FLUSH flag ensures the
pipeline is flushed when call returns
**TODO - is this correct or do we need**
**to wait for ASYNC_DONE**
end note

GStreamer_server   --> rialtoServer:
rialtoServer       --> rialtoClient:
rialtoClient       --> GStreamer_clientApplication:

opt Seek initiated successfully
rialtoServer       -/  rialtoClient:      notifyPlaybackState(pipeline_session, PLAYBACK_STATE_SEEK_DONE)
rialtoClient       -/  GStreamer_client:Application:       notifyPlaybackState(pipeline_session, PLAYBACK_STATE_SEEK_DONE)
else Error initiating seek
rialtoServer       -/  rialtoClient:      notifyPlaybackState(pipeline_session, PLAYBACK_STATE_FAILURE)
rialtoClient       -/  GStreamer_clientApplication:       notifyPlaybackState(pipeline_session, PLAYBACK_STATE_FAILURE)
end

rialtoServer       ->  rialtoServer:      trigger need data for all attached sources

ref over GStreamer_clientApplication, rialtoServer
Start requesting samples as for regular playback
end ref

@enduml

...

PlantUML Macro
formatSVG
titleSet Source Position
@startuml

autonumber

box "Container" #LightGreen
participant Application
participant GStreamer_client
participant rialtoClient
end box

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

Application        ->  GStreamer_client:  gst_element_send_event(sink, gst_event_new_segment(position))
GStreamer_client   --> Application:
GStreamer_client   ->  rialtoClient:      setSourcePosition(sourceId, position)
rialtoClient       ->  rialtoServer:      setSourcePosition(sourceId, position)
rialtoServer       ->  rialtoServer:      Save requested position internally
opt Source Setup Finished
rialtoServer       ->  rialtoServer:      Erase EOS info
rialtoServer       ->  rialtoServer:      Trigger NeedData for source
end
rialtoServer       --> rialtoClient:
rialtoClient       --> GStreamer_client:

rialtoClient       --> rialtoServer:      HaveData()
note left
HaveData received as a response to
NeedMediaData sent in SetSourcePosition
or in FinishSetupSource scenario
end note

rialtoServer       ->  GStreamer_server:  gst_segment_new()
GStreamer_server   --> rialtoServer:      segment
rialtoServer       ->  GStreamer_server:  gst_segment_init(segment, GST_FORMAT_TIME)
GStreamer_server   --> rialtoServer:
rialtoServer       ->  GStreamer_server:  gst_segment_do_seek(segment, current_playback_rate, position)
GStreamer_server   --> rialtoServer:
rialtoServer       ->  GStreamer_server:  gst_baseapp_src_newget_segment(source, segmentcaps(appsrc)
GStreamer_server   --> rialtoServer:      caps
rialtoServer       ->  rialtoServer:      buffer = nextBufferInQueue(appsrc)
rialtoServer       ->  GStreamer_server:  gst_segmentsample_free(new(buffer, caps, segment)
GStreamer_server   --> rialtoServer:      sample
rialtoServer       ->  rialtoServerGStreamer_server:  gst_app_src_push_sample(appsrc, sample)
GStreamer_server   Erase EOS info--> rialtoServer:
rialtoServer       ->  GStreamer_server:  gst_sample_unref(sample)
GStreamer_server   --> rialtoServer:
rialtoServer       -> Trigger NeedDataGStreamer_server: for source
 gst_caps_unref(caps)
GStreamer_server   --> rialtoServer:
rialtoServer       ->  GStreamer_server:  gst_segment_free(segment)
GStreamer_server   --> rialtoClientrialtoServer:
rialtoClientrialtoServer       --> GStreamer_clientrialtoClient:

@enduml

Flush

PlantUML Macro
formatSVG
titleFlush
@startuml

autonumber

box "Container" #LightGreen
participant Application
participant GStreamer_client
participant rialtoClient
end box

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

note over GStreamer_client
The Rialto's client should abort any pending needData() requests before calling flush and ignore any
needData() requests received before the sourceFlushed event as they will be stale.
** TODO - document this in the API header file **
end note

Application        ->  GStreamer_client:  gst_element_send_event(sink, gst_event_new_flush_start())
GStreamer_client   --> Application:
Application        ->  GStreamer_client:  gst_element_send_event(sink, gst_event_new_flush_stop(resetTime))
GStreamer_client   ->  rialtoClient:      flush(sourceId, resetTime)
rialtoClient       ->  rialtoClient:      clear local cache of any active data requests for flushed source
rialtoClient       ->  rialtoServer:      flush(sourceId, resetTime)
rialtoServer       ->  rialtoServer:      stop sending new need data requests for flushed source
rialtoServer       ->  rialtoServer:      clear local cache of any active data requests for flushed source
rialtoServer       ->  rialtoServer:      clear buffered samples for flushed source
rialtoServer       ->  GStreamer_server:  gst_element_send_event(source, gst_event_new_flush_start())
GStreamer_server   --> rialtoServer:
rialtoServer       ->  GStreamer_server:  gst_element_send_event(source, gst_event_new_flush_stop(resetTime))
GStreamer_server   --> rialtoServer:
rialtoServer       ->  rialtoServer:      Erase EOS info

rialtoServer       --> rialtoClient:
rialtoClient       --> GStreamer_client:
GStreamer_client   --> Application:

rialtoServer       -/  rialtoClient:      notifySourceFlushed(sourceId)
rialtoClient       -/  GStreamer_client:  notifySourceFlushed(sourceId)

ref over GStreamer_client, rialtoServer
Start requesting samples as for regular playback
end ref

@enduml

...