Ejemplo n.º 1
0
void
SourceStreamInfo::RemoveTrack(const std::string& trackId)
{
  mTracks.erase(trackId);
  RefPtr<MediaPipeline> pipeline = GetPipelineByTrackId_m(trackId);
  if (pipeline) {
    mPipelines.erase(trackId);
    pipeline->ShutdownMedia_m();
    mParent->GetSTSThread()->Dispatch(
        WrapRunnableNM(PipelineDetachTransport_s,
                       pipeline.forget(),
                       mParent->GetMainThread()),
        NS_DISPATCH_NORMAL);
  }
}
Ejemplo n.º 2
0
void RemoteSourceStreamInfo::UpdatePrincipal_m(nsIPrincipal* aPrincipal)
{
  // This blasts away the existing principal.
  // We only do this when we become certain that the all tracks are safe to make
  // accessible to the script principal.
  for (auto& trackPair : mTracks) {
    MOZ_RELEASE_ASSERT(trackPair.second);
    RemoteTrackSource& source =
      static_cast<RemoteTrackSource&>(trackPair.second->GetSource());
    source.SetPrincipal(aPrincipal);

    RefPtr<MediaPipeline> pipeline = GetPipelineByTrackId_m(trackPair.first);
    if (pipeline) {
      MOZ_ASSERT(pipeline->direction() == MediaPipeline::RECEIVE);
      static_cast<MediaPipelineReceive*>(pipeline.get())
        ->SetPrincipalHandle_m(MakePrincipalHandle(aPrincipal));
    }
  }
}