media_log_properties.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_BASE_MEDIA_LOG_PROPERTIES_H_
  5. #define MEDIA_BASE_MEDIA_LOG_PROPERTIES_H_
  6. #include <string>
  7. #include <vector>
  8. #include "base/time/time.h"
  9. #include "media/base/audio_decoder_config.h"
  10. #include "media/base/media_export.h"
  11. #include "media/base/media_log_type_enforcement.h"
  12. #include "media/base/renderer_factory_selector.h"
  13. #include "media/base/text_track_config.h"
  14. #include "media/base/video_decoder_config.h"
  15. #include "ui/gfx/geometry/size.h"
  16. namespace media {
  17. // A list of all properties that can be set by a MediaLog. To add a new
  18. // property, it must be added in this enum and have it's type defined below
  19. // using MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(<name>, <type>) or with a custom
  20. // specializer. See MEDIA_LOG_PROEPRTY_SUPPORTS_GFX_SIZE as an example.
  21. enum class MediaLogProperty {
  22. // Video resolution.
  23. kResolution,
  24. // Size of the media content in bytes.
  25. kTotalBytes,
  26. // How many bits-per-second this media uses.
  27. kBitrate,
  28. // The maximum duration of the media in seconds.
  29. kMaxDuration,
  30. // The time at which media starts, in seconds.
  31. kStartTime,
  32. // If the video decoder is using a decrypting decoder to playback media.
  33. kIsVideoEncrypted,
  34. // Represents whether the media source supports range requests. A truthful
  35. // value here means that range requests aren't supported and seeking probably
  36. // wont be supported.
  37. kIsStreaming,
  38. // The url and title of the frame containing the document that this media
  39. // player is loaded into.
  40. kFrameUrl,
  41. kFrameTitle,
  42. // Whether the media content coming from the same origin as the frame in which
  43. // the player is loaded.
  44. kIsSingleOrigin,
  45. // Can the url loading the data support the range http header, allowing chunks
  46. // to be sent rather than entire file.
  47. kIsRangeHeaderSupported,
  48. // The name of media::Renderer currently being used to play the media stream.
  49. kRendererName,
  50. // The name of the decoder implementation currently being used to play the
  51. // media stream. All audio/video decoders have id numbers defined in
  52. // decoder.h.
  53. kVideoDecoderName,
  54. kAudioDecoderName,
  55. // Whether this decoder is using hardware accelerated decoding.
  56. kIsPlatformVideoDecoder,
  57. kIsPlatformAudioDecoder,
  58. // Webcodecs supports encoding video streams.
  59. kVideoEncoderName,
  60. kIsPlatformVideoEncoder,
  61. // Whether this media player is using a decrypting demuxer for the given
  62. // audio or video stream.
  63. kIsVideoDecryptingDemuxerStream,
  64. kIsAudioDecryptingDemuxerStream,
  65. // Track metadata.
  66. kAudioTracks,
  67. kTextTracks,
  68. kVideoTracks,
  69. // Effective video playback frame rate adjusted for the playback speed.
  70. // Updated along with kVideoPlaybackRoughness (i.e. not very often)
  71. kFramerate,
  72. // A playback quality metric calculated by VideoPlaybackRoughnessReporter
  73. kVideoPlaybackRoughness,
  74. // A playback quality metric that tries to account for large pauses and/or
  75. // discontinuities during playback.
  76. kVideoPlaybackFreezing,
  77. };
  78. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kResolution, gfx::Size);
  79. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kTotalBytes, int64_t);
  80. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kBitrate, int);
  81. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kMaxDuration, float);
  82. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kStartTime, float);
  83. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kIsVideoEncrypted, bool);
  84. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kIsVideoEncrypted, std::string);
  85. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kIsStreaming, bool);
  86. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kFrameUrl, std::string);
  87. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kFrameTitle, std::string);
  88. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kIsSingleOrigin, bool);
  89. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kRendererName, RendererType);
  90. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kVideoDecoderName, VideoDecoderType);
  91. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kIsPlatformVideoDecoder, bool);
  92. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kIsRangeHeaderSupported, bool);
  93. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kIsVideoDecryptingDemuxerStream, bool);
  94. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kAudioDecoderName, AudioDecoderType);
  95. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kIsPlatformAudioDecoder, bool);
  96. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kVideoEncoderName, std::string);
  97. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kIsPlatformVideoEncoder, bool);
  98. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kIsAudioDecryptingDemuxerStream, bool);
  99. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kAudioTracks, std::vector<AudioDecoderConfig>);
  100. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kTextTracks, std::vector<TextTrackConfig>);
  101. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kVideoTracks, std::vector<VideoDecoderConfig>);
  102. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kFramerate, double);
  103. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kVideoPlaybackRoughness, double);
  104. MEDIA_LOG_PROPERTY_SUPPORTS_TYPE(kVideoPlaybackFreezing, base::TimeDelta);
  105. // Convert the enum to a string (used for the front-end enum matching).
  106. MEDIA_EXPORT std::string MediaLogPropertyKeyToString(MediaLogProperty property);
  107. } // namespace media
  108. #endif // MEDIA_BASE_MEDIA_LOG_PROPERTIES_H_