summaryrefslogtreecommitdiffstats
path: root/media/base/limits.h
blob: d6a50d40c5ca3d65df32209136da1181bc20d7db (plain)
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
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Contains limit definition constants for the media subsystem.

#ifndef MEDIA_BASE_LIMITS_H_
#define MEDIA_BASE_LIMITS_H_

namespace media {

namespace limits {

enum {
  // Maximum possible dimension (width or height) for any video.
  kMaxDimension = (1 << 15) - 1,  // 32767

  // Maximum possible canvas size (width multiplied by height) for any video.
  kMaxCanvas = (1 << (14 * 2)),  // 16384 x 16384

  // Total number of video frames which are populating in the pipeline.
  kMaxVideoFrames = 4,

  // The following limits are used by AudioParameters::IsValid().
  //
  // A few notes on sample rates of common formats:
  //   - AAC files are limited to 96 kHz.
  //   - MP3 files are limited to 48 kHz.
  //   - Vorbis used to be limited to 96 kHz, but no longer has that
  //     restriction.
  //   - Most PC audio hardware is limited to 192 kHz, some specialized DAC
  //     devices will use 384 kHz though.
  kMaxSampleRate = 384000,
  kMinSampleRate = 3000,
  kMaxChannels = 32,
  kMaxBytesPerSample = 4,
  kMaxBitsPerSample = kMaxBytesPerSample * 8,
  kMaxSamplesPerPacket = kMaxSampleRate,
  kMaxPacketSizeInBytes =
      kMaxBytesPerSample * kMaxChannels * kMaxSamplesPerPacket,

  // This limit is used by ParamTraits<VideoCaptureParams>.
  kMaxFramesPerSecond = 1000,

  // Maximum lengths for various EME API parameters. These are checks to
  // prevent unnecessarily large parameters from being passed around, and the
  // lengths are somewhat arbitrary as the EME spec doesn't specify any limits.
  kMinCertificateLength = 128,
  kMaxCertificateLength = 16 * 1024,
  kMaxSessionIdLength = 512,
  kMinKeyIdLength = 1,
  kMaxKeyIdLength = 512,
  kMaxKeyIds = 128,
  kMaxInitDataLength = 64 * 1024,         // 64 KB
  kMaxSessionResponseLength = 64 * 1024,  // 64 KB
  kMaxKeySystemLength = 256,
};

}  // namespace limits

}  // namespace media

#endif  // MEDIA_BASE_LIMITS_H_