Repository: xbmc/xbmc
File: xbmc/pvr/PVRPlaybackState.cpp (C++)

Code before:
                                      PVR_SOURCE source) const
{
  // Obtain dynamic playback url and properties from the respective pvr client
  const std::shared_ptr<const CPVRClient> client = CServiceBroker::GetPVRManager().GetClient(*item);
  if (client)
  {
    CPVRStreamProperties props;

    if (item->IsPVRChannel())
    {
      if (source == PVR_SOURCE::DEFAULT)
      {
        PVR_ERROR retVal = client->StreamClosed();
        if (retVal != PVR_ERROR_NO_ERROR)
          CLog::LogFC(LOGERROR, LOGPVR, "Client error on call to StreamClosed(): {}",
                      CPVRClient::ToString(retVal));
      }

      client->GetChannelStreamProperties(item->GetPVRChannelInfoTag(), source, props);

      if (props.LivePlaybackAsEPG())
      {
        const std::shared_ptr<CPVREpgInfoTag> epgTag = item->GetPVRChannelInfoTag()->GetEPGNow();
        if (epgTag)
        {
          item.reset(new CFileItem(epgTag));
        }
      }
    }
    else if (item->IsPVRRecording())
    {
      client->GetRecordingStreamProperties(item->GetPVRRecordingInfoTag(), props);
    }
    else if (item->IsEPG())
    {
      PVR_ERROR retVal = client->StreamClosed();
      if (retVal != PVR_ERROR_NO_ERROR)
        CLog::LogFC(LOGERROR, LOGPVR, "Client error on call to StreamClosed(): {}",
                    CPVRClient::ToString(retVal));

      client->GetEpgTagStreamProperties(item->GetEPGInfoTag(), props);

      if (mode == ContentUtils::PlayMode::CHECK_AUTO_PLAY_NEXT_ITEM)
      {
        if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
                CSettings::SETTING_PVRPLAYBACK_AUTOPLAYNEXTPROGRAMME))
          item->SetProperty("epg_playlist_item", true);
      }
      else if (mode == ContentUtils::PlayMode::PLAY_FROM_HERE)
      {
        item->SetProperty("epg_playlist_item", true);

Review comment (suggestion):
I'm more in favor for `item = std::make_unique<CFileItem>(epgTag);`, like you do at the other places.

Code after:
                                      PVR_SOURCE source) const
{
  // Obtain dynamic playback url and properties from the respective pvr client
  const std::shared_ptr<const CPVRClient> client = CServiceBroker::GetPVRManager().GetClient(*item);
  if (client)
  {
    CPVRStreamProperties props;

    if (item->IsPVRChannel())
    {
      if (source == PVR_SOURCE::DEFAULT)
      {
        PVR_ERROR retVal = client->StreamClosed();
        if (retVal != PVR_ERROR_NO_ERROR)
          CLog::LogFC(LOGERROR, LOGPVR, "Client error on call to StreamClosed(): {}",
                      CPVRClient::ToString(retVal));
      }

      client->GetChannelStreamProperties(item->GetPVRChannelInfoTag(), source, props);

      if (props.LivePlaybackAsEPG())
      {
        const std::shared_ptr<CPVREpgInfoTag> epgTag = item->GetPVRChannelInfoTag()->GetEPGNow();
        if (epgTag)
        {
          item = std::make_unique<CFileItem>(epgTag);
        }
      }
    }
    else if (item->IsPVRRecording())
    {
      client->GetRecordingStreamProperties(item->GetPVRRecordingInfoTag(), props);
    }
    else if (item->IsEPG())
    {
      PVR_ERROR retVal = client->StreamClosed();
      if (retVal != PVR_ERROR_NO_ERROR)
        CLog::LogFC(LOGERROR, LOGPVR, "Client error on call to StreamClosed(): {}",
                    CPVRClient::ToString(retVal));

      client->GetEpgTagStreamProperties(item->GetEPGInfoTag(), props);

      if (mode == ContentUtils::PlayMode::CHECK_AUTO_PLAY_NEXT_ITEM)
      {
        if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
                CSettings::SETTING_PVRPLAYBACK_AUTOPLAYNEXTPROGRAMME))
          item->SetProperty("epg_playlist_item", true);
      }
      else if (mode == ContentUtils::PlayMode::PLAY_FROM_HERE)
      {
        item->SetProperty("epg_playlist_item", true);