std::string WebContents::GetMediaSourceID(
    content::WebContents* request_web_contents) {
  auto* frame_host = web_contents()->GetMainFrame();
  if (!frame_host)
    return std::string();

  content::DesktopMediaID media_id(
      content::DesktopMediaID::TYPE_WEB_CONTENTS,
      content::DesktopMediaID::kNullId,
      content::WebContentsMediaCaptureId(frame_host->GetProcess()->GetID(),
                                         frame_host->GetRoutingID()));

  auto* request_frame_host = request_web_contents->GetMainFrame();
  if (!request_frame_host)
    return std::string();

  std::string id =
      content::DesktopStreamsRegistry::GetInstance()->RegisterStream(
          request_frame_host->GetProcess()->GetID(),
          request_frame_host->GetRoutingID(),
          url::Origin::Create(request_frame_host->GetLastCommittedURL()
                                  .DeprecatedGetOriginAsURL()),
          media_id, "", content::kRegistryStreamTypeTab);

  return id;
}
std::string WebContents::GetMediaSourceID(
    content::WebContents* request_web_contents) {
  auto* frame_host = web_contents()->GetMainFrame();
  if (!frame_host)
    return std::string();

  content::DesktopMediaID media_id(
      content::DesktopMediaID::TYPE_WEB_CONTENTS,
      content::DesktopMediaID::kNullId,
      content::WebContentsMediaCaptureId(frame_host->GetProcess()->GetID(),
                                         frame_host->GetRoutingID()));

  auto* request_frame_host = request_web_contents->GetMainFrame();
  if (!request_frame_host)
    return std::string();

  std::string id =
      content::DesktopStreamsRegistry::GetInstance()->RegisterStream(
          request_frame_host->GetProcess()->GetID(),
          request_frame_host->GetRoutingID(),
          url::Origin::Create(request_frame_host->GetLastCommittedURL()
                                  .DeprecatedGetOriginAsURL()),
          media_id, "", content::kRegistryStreamTypeTab);

  return id;
}