1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75

media / base / renderer.cc [blame]

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/base/renderer.h"
#include "base/logging.h"

namespace media {

// WARNING: The returned names are used as part of UMA names. Do NOT change
// existing return names.
std::string GetRendererName(RendererType renderer_type) {
  switch (renderer_type) {
    case RendererType::kRendererImpl:
      return "RendererImpl";
    case RendererType::kMojo:
      return "MojoRenderer";
    case RendererType::kMediaPlayer:
      return "MediaPlayerRenderer";
    case RendererType::kCourier:
      return "CourierRenderer";
    case RendererType::kFlinging:
      return "FlingingRenderer";
    case RendererType::kCast:
      return "CastRenderer";
    case RendererType::kMediaFoundation:
      return "MediaFoundationRenderer";
    case RendererType::kRemoting:
      return "RemotingRenderer";  // media::remoting::Receiver
    case RendererType::kCastStreaming:
      return "CastStreamingRenderer";
    case RendererType::kContentEmbedderDefined:
      return "EmbedderDefined";
    case RendererType::kTest:
      return "Media Renderer Implementation For Testing";
  }
}

Renderer::Renderer() = default;

Renderer::~Renderer() = default;

void Renderer::SetCdm(CdmContext* cdm_context, CdmAttachedCB cdm_attached_cb) {
  DLOG(WARNING) << "CdmContext is not supported.";
  std::move(cdm_attached_cb).Run(false);
}

void Renderer::OnSelectedVideoTracksChanged(
    const std::vector<DemuxerStream*>& enabled_tracks,
    base::OnceClosure change_completed_cb) {
  DLOG(WARNING) << "Track changes are not supported.";
  std::move(change_completed_cb).Run();
}

void Renderer::OnEnabledAudioTracksChanged(
    const std::vector<DemuxerStream*>& enabled_tracks,
    base::OnceClosure change_completed_cb) {
  DLOG(WARNING) << "Track changes are not supported.";
  std::move(change_completed_cb).Run();
}

void Renderer::SetPreservesPitch(bool preserves_pitch) {
  // Not supported by most renderers.
}

void Renderer::SetWasPlayedWithUserActivationAndHighMediaEngagement(
    bool was_played_with_user_activation_and_high_media_engagement) {
  // Not supported by most renderers.
}

void Renderer::OnExternalVideoFrameRequest() {
  // Default implementation of OnExternalVideoFrameRequest is to no-op.
}

}  // namespace media