diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-05-09 14:22:11 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-05-09 15:11:45 +0000 |
commit | 2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c (patch) | |
tree | e75f511546c5fd1a173e87c1f9fb11d7ac8d1af3 /chromium/chromecast/public | |
parent | a4f3d46271c57e8155ba912df46a05559d14726e (diff) | |
download | qtwebengine-chromium-2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c.tar.gz |
BASELINE: Update Chromium to 51.0.2704.41
Also adds in all smaller components by reversing logic for exclusion.
Change-Id: Ibf90b506e7da088ea2f65dcf23f2b0992c504422
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'chromium/chromecast/public')
-rw-r--r-- | chromium/chromecast/public/avsettings.h | 20 | ||||
-rw-r--r-- | chromium/chromecast/public/cast_media_shlib.h | 50 | ||||
-rw-r--r-- | chromium/chromecast/public/media/decoder_config.h | 112 |
3 files changed, 165 insertions, 17 deletions
diff --git a/chromium/chromecast/public/avsettings.h b/chromium/chromecast/public/avsettings.h index d0e71b732c9..0c3fd7fe883 100644 --- a/chromium/chromecast/public/avsettings.h +++ b/chromium/chromecast/public/avsettings.h @@ -107,11 +107,19 @@ class AvSettings { // platform. WAKE_ON_CAST_CHANGED = 6, + // This event shall be fired whenever the volume step interval provided + // by the device is changed, for e.g. when connecting to an AVR setup + // where step interval should be 1%. + AUDIO_VOLUME_STEP_INTERVAL_CHANGED = 7, + // This event should be fired when the device is connected to HDMI sinks. HDMI_CONNECTED = 100, // This event should be fired when the device is disconnected to HDMI sinks. HDMI_DISCONNECTED = 101, + + // This event should be fired when an HDMI error occurs. + HDMI_ERROR = 102, }; // Delegate to inform the caller events. As a subclass of TaskRunner, @@ -177,6 +185,18 @@ class AvSettings { // Nexus Player which is fixed volume. virtual AudioVolumeControlType GetAudioVolumeControlType() = 0; + // Retrieves the volume step interval in range [0.0, 1.0] that specifies how + // much volume to change per step, e.g. 0.05 = 5%. Returns true if a valid + // interval is specified by platform; returns false if interval should defer + // to default values. + // + // Current default volume step intervals per control type are as follows: + // - MASTER_VOLUME: 0.05 (5%) + // - ATTENUATION_VOLUME: 0.02 (2%) + // - FIXED_VOLUME: 0.01 (1%) + // - UNKNOWN_VOLUME: 0.01 (1%) + virtual bool GetAudioVolumeStepInterval(float* step_inteval) = 0; + // Returns the current volume level, which must be from 0.0 (inclusive) to // 1.0 (inclusive). virtual float GetAudioVolume() = 0; diff --git a/chromium/chromecast/public/cast_media_shlib.h b/chromium/chromecast/public/cast_media_shlib.h index ca11f49c4eb..0f8366222d7 100644 --- a/chromium/chromecast/public/cast_media_shlib.h +++ b/chromium/chromecast/public/cast_media_shlib.h @@ -5,6 +5,8 @@ #ifndef CHROMECAST_PUBLIC_CAST_MEDIA_SHLIB_H_ #define CHROMECAST_PUBLIC_CAST_MEDIA_SHLIB_H_ +#include <stdint.h> + #include <string> #include <vector> @@ -13,6 +15,8 @@ namespace chromecast { namespace media { +enum SampleFormat : int; + class MediaPipelineBackend; struct MediaPipelineDeviceParams; class VideoPlane; @@ -28,6 +32,33 @@ class VideoPlane; // from other tests. class CHROMECAST_EXPORT CastMediaShlib { public: + // Observer for audio loopback data. + class LoopbackAudioObserver { + public: + // Called whenever audio data is about to be output. The |timestamp| is the + // estimated time in microseconds (relative to CLOCK_MONOTONIC_RAW) that + // the audio will actually be output. |length| is the length of the audio + // |data| in bytes. The format of the data is given by |sample_format| and + // |num_channels|. + // This method may be called by any thread, and MUST not block or take very + // much time (to avoid audio underruns). + virtual void OnLoopbackAudio(int64_t timestamp, + SampleFormat sample_format, + int sample_rate, + int num_channels, + uint8_t* data, + int length) = 0; + + // Called once this observer has been fully removed by a call to + // RemoveLoopbackAudioObserver(). After this is called, no more calls to + // OnLoopbackAudio() will be made for this observer unless it is added + // again. This method could be called from any thread. + virtual void OnRemoved() = 0; + + protected: + virtual ~LoopbackAudioObserver() {} + }; + // Initializes platform-specific media systems. Only called when in an // uninitialized state. static void Initialize(const std::vector<std::string>& argv); @@ -62,6 +93,25 @@ class CHROMECAST_EXPORT CastMediaShlib { // Tests if the implementation supports renderer clock rate adjustments. static bool SupportsMediaClockRateChange(); + + // Adds a loopback audio observer. An observer will not be added more than + // once without being removed first. + // This function is optional to implement. + static void AddLoopbackAudioObserver(LoopbackAudioObserver* observer) + __attribute__((__weak__)); + + // Removes a loopback audio observer. An observer will not be removed unless + // it was previously added, and will not be removed more than once without + // being added again first. + // Once the observer is fully removed (ie. once it is certain that + // OnLoopbackAudio() will not be called again for the observer), the + // observer's OnRemoved() method must be called. The OnRemoved() method must + // be called once for each time that RemoveLoopbackAudioObserver() is called + // for a given observer, even if the observer was not added. The + // implementation may call OnRemoved() from any thread. + // This function is optional to implement. + static void RemoveLoopbackAudioObserver(LoopbackAudioObserver* observer) + __attribute__((__weak__)); }; } // namespace media diff --git a/chromium/chromecast/public/media/decoder_config.h b/chromium/chromecast/public/media/decoder_config.h index e2cf78dcbc6..540dd072cab 100644 --- a/chromium/chromecast/public/media/decoder_config.h +++ b/chromium/chromecast/public/media/decoder_config.h @@ -19,7 +19,7 @@ static const int kMaxBytesPerSample = 4; // Maximum audio sampling rate. static const int kMaxSampleRate = 192000; -enum AudioCodec { +enum AudioCodec : int { kAudioCodecUnknown = 0, kCodecAAC, kCodecMP3, @@ -36,7 +36,7 @@ enum AudioCodec { kAudioCodecMax = kCodecFLAC, }; -enum SampleFormat { +enum SampleFormat : int { kUnknownSampleFormat = 0, kSampleFormatU8, // Unsigned 8-bit w/ bias of 128. kSampleFormatS16, // Signed 16-bit. @@ -51,7 +51,7 @@ enum SampleFormat { kSampleFormatMax = kSampleFormatS24, }; -enum VideoCodec { +enum VideoCodec : int { kVideoCodecUnknown = 0, kCodecH264, kCodecVC1, @@ -61,13 +61,15 @@ enum VideoCodec { kCodecVP8, kCodecVP9, kCodecHEVC, + kCodecDolbyVisionH264, + kCodecDolbyVisionHEVC, kVideoCodecMin = kVideoCodecUnknown, - kVideoCodecMax = kCodecHEVC, + kVideoCodecMax = kCodecDolbyVisionHEVC, }; // Profile for Video codec. -enum VideoProfile { +enum VideoProfile : int { kVideoProfileUnknown = 0, kH264Baseline, kH264Main, @@ -81,19 +83,92 @@ enum VideoProfile { kH264Stereohigh, kH264MultiviewHigh, kVP8ProfileAny, - kVP9ProfileAny, + kVP9Profile0, + kVP9Profile1, + kVP9Profile2, + kVP9Profile3, + kDolbyVisionCompatible_EL_MD, + kDolbyVisionCompatible_BL_EL_MD, + kDolbyVisionNonCompatible_BL_MD, + kDolbyVisionNonCompatible_BL_EL_MD, kVideoProfileMin = kVideoProfileUnknown, - kVideoProfileMax = kVP9ProfileAny, + kVideoProfileMax = kDolbyVisionNonCompatible_BL_EL_MD, }; -// TODO(erickung): Remove constructor once CMA backend implementation does't +// Specification of whether and how the stream is encrypted (in whole or part). +struct EncryptionScheme { + // Algorithm and mode that was used to encrypt the stream. + enum CipherMode { + CIPHER_MODE_UNENCRYPTED, + CIPHER_MODE_AES_CTR, + CIPHER_MODE_AES_CBC + }; + + // CENC 3rd Edition adds pattern encryption, through two new protection + // schemes: 'cens' (with AES-CTR) and 'cbcs' (with AES-CBC). + // The pattern applies independently to each 'encrypted' part of the frame (as + // defined by the relevant subsample entries), and reduces further the + // actual encryption applied through a repeating pattern of (encrypt:skip) + // 16 byte blocks. For example, in a (1:9) pattern, the first block is + // encrypted, and the next nine are skipped. This pattern is applied + // repeatedly until the end of the last 16-byte block in the subsample. + // Any remaining bytes are left clear. + // If either of encrypt_blocks or skip_blocks is 0, pattern encryption is + // disabled. + struct Pattern { + Pattern() {} + Pattern(uint32_t encrypt_blocks, uint32_t skip_blocks); + ~Pattern() {} + bool IsInEffect() const; + + uint32_t encrypt_blocks = 0; + uint32_t skip_blocks = 0; + }; + + EncryptionScheme() {} + EncryptionScheme(CipherMode mode, const Pattern& pattern); + ~EncryptionScheme() {} + bool is_encrypted() const { return mode != CIPHER_MODE_UNENCRYPTED; } + + CipherMode mode = CIPHER_MODE_UNENCRYPTED; + Pattern pattern; +}; + +inline EncryptionScheme::Pattern::Pattern(uint32_t encrypt_blocks, + uint32_t skip_blocks) + : encrypt_blocks(encrypt_blocks), skip_blocks(skip_blocks) { +} + +inline bool EncryptionScheme::Pattern::IsInEffect() const { + return encrypt_blocks != 0 && skip_blocks != 0; +} + +inline EncryptionScheme::EncryptionScheme(CipherMode mode, + const Pattern& pattern) + : mode(mode), pattern(pattern) { +} + +inline EncryptionScheme Unencrypted() { + return EncryptionScheme(); +} + +inline EncryptionScheme AesCtrEncryptionScheme() { + return EncryptionScheme(EncryptionScheme::CIPHER_MODE_AES_CTR, + EncryptionScheme::Pattern()); +} + + +// TODO(erickung): Remove constructor once CMA backend implementation doesn't // create a new object to reset the configuration and use IsValidConfig() to // determine if the configuration is still valid or not. struct AudioConfig { AudioConfig(); + AudioConfig(const AudioConfig& other); ~AudioConfig(); + bool is_encrypted() const { return encryption_scheme.is_encrypted(); } + // Stream id. StreamId id; // Audio codec. @@ -108,8 +183,8 @@ struct AudioConfig { int samples_per_second; // Extra data buffer for certain codec initialization. std::vector<uint8_t> extra_data; - // content is encrypted or not. - bool is_encrypted; + // Encryption scheme (if any) used for the content. + EncryptionScheme encryption_scheme; }; inline AudioConfig::AudioConfig() @@ -118,10 +193,9 @@ inline AudioConfig::AudioConfig() sample_format(kUnknownSampleFormat), bytes_per_channel(0), channel_number(0), - samples_per_second(0), - is_encrypted(false) { + samples_per_second(0) { } - +inline AudioConfig::AudioConfig(const AudioConfig& other) = default; inline AudioConfig::~AudioConfig() { } @@ -130,8 +204,11 @@ inline AudioConfig::~AudioConfig() { // determine if the configuration is still valid or not. struct VideoConfig { VideoConfig(); + VideoConfig(const VideoConfig& other); ~VideoConfig(); + bool is_encrypted() const { return encryption_scheme.is_encrypted(); } + // Stream Id. StreamId id; // Video codec. @@ -144,18 +221,19 @@ struct VideoConfig { VideoConfig* additional_config; // Extra data buffer for certain codec initialization. std::vector<uint8_t> extra_data; - // content is encrypted or not. - bool is_encrypted; + // Encryption scheme (if any) used for the content. + EncryptionScheme encryption_scheme; }; inline VideoConfig::VideoConfig() : id(kPrimary), codec(kVideoCodecUnknown), profile(kVideoProfileUnknown), - additional_config(nullptr), - is_encrypted(false) { + additional_config(nullptr) { } +inline VideoConfig::VideoConfig(const VideoConfig& other) = default; + inline VideoConfig::~VideoConfig() { } |