diff --git a/media/filters/decrypting_audio_decoder.cc b/media/filters/decrypting_audio_decoder.cc index 2c8020d908d2a..ed41d539c67fb 100644 --- a/media/filters/decrypting_audio_decoder.cc +++ b/media/filters/decrypting_audio_decoder.cc @@ -37,13 +37,7 @@ static inline bool IsOutOfSync(const base::TimeDelta& timestamp_1, DecryptingAudioDecoder::DecryptingAudioDecoder( const scoped_refptr& task_runner, MediaLog* media_log) - : task_runner_(task_runner), - media_log_(media_log), - state_(kUninitialized), - decryptor_(NULL), - key_added_while_decode_pending_(false), - support_clear_content_(false), - weak_factory_(this) {} + : task_runner_(task_runner), media_log_(media_log), weak_factory_(this) {} std::string DecryptingAudioDecoder::GetDisplayName() const { return "DecryptingAudioDecoder"; diff --git a/media/filters/decrypting_audio_decoder.h b/media/filters/decrypting_audio_decoder.h index abc1d089b82e3..95f8d23429567 100644 --- a/media/filters/decrypting_audio_decoder.h +++ b/media/filters/decrypting_audio_decoder.h @@ -88,11 +88,11 @@ class MEDIA_EXPORT DecryptingAudioDecoder : public AudioDecoder { // Sets timestamps for |frames| and then passes them to |output_cb_|. void ProcessDecodedFrames(const Decryptor::AudioFrames& frames); - scoped_refptr task_runner_; + // Set in constructor. + scoped_refptr const task_runner_; + MediaLog* const media_log_; - MediaLog* media_log_; - - State state_; + State state_ = kUninitialized; InitCB init_cb_; OutputCB output_cb_; @@ -103,7 +103,7 @@ class MEDIA_EXPORT DecryptingAudioDecoder : public AudioDecoder { // The current decoder configuration. AudioDecoderConfig config_; - Decryptor* decryptor_; + Decryptor* decryptor_ = nullptr; // The buffer that needs decrypting/decoding. scoped_refptr pending_buffer_to_decode_; @@ -113,13 +113,13 @@ class MEDIA_EXPORT DecryptingAudioDecoder : public AudioDecoder { // If this variable is true and kNoKey is returned then we need to try // decrypting/decoding again in case the newly added key is the correct // decryption key. - bool key_added_while_decode_pending_; + bool key_added_while_decode_pending_ = false; std::unique_ptr timestamp_helper_; // Once Initialized() with encrypted content support, if the stream changes to // clear content, we want to ensure this decoder remains used. - bool support_clear_content_; + bool support_clear_content_ = false; base::WeakPtr weak_this_; base::WeakPtrFactory weak_factory_; diff --git a/media/filters/decrypting_video_decoder.cc b/media/filters/decrypting_video_decoder.cc index 32ed82c2eab83..1c0a3a975cf26 100644 --- a/media/filters/decrypting_video_decoder.cc +++ b/media/filters/decrypting_video_decoder.cc @@ -24,13 +24,7 @@ const char DecryptingVideoDecoder::kDecoderName[] = "DecryptingVideoDecoder"; DecryptingVideoDecoder::DecryptingVideoDecoder( const scoped_refptr& task_runner, MediaLog* media_log) - : task_runner_(task_runner), - media_log_(media_log), - state_(kUninitialized), - decryptor_(NULL), - key_added_while_decode_pending_(false), - support_clear_content_(false), - weak_factory_(this) {} + : task_runner_(task_runner), media_log_(media_log), weak_factory_(this) {} std::string DecryptingVideoDecoder::GetDisplayName() const { return kDecoderName; diff --git a/media/filters/decrypting_video_decoder.h b/media/filters/decrypting_video_decoder.h index a9229c97b6b87..03cec55319598 100644 --- a/media/filters/decrypting_video_decoder.h +++ b/media/filters/decrypting_video_decoder.h @@ -84,11 +84,11 @@ class MEDIA_EXPORT DecryptingVideoDecoder : public VideoDecoder { void CompletePendingDecode(Decryptor::Status status); void CompleteWaitingForDecryptionKey(); - scoped_refptr task_runner_; + // Set in constructor. + scoped_refptr const task_runner_; + MediaLog* const media_log_; - MediaLog* media_log_; - - State state_; + State state_ = kUninitialized; InitCB init_cb_; OutputCB output_cb_; @@ -98,7 +98,7 @@ class MEDIA_EXPORT DecryptingVideoDecoder : public VideoDecoder { VideoDecoderConfig config_; - Decryptor* decryptor_; + Decryptor* decryptor_ = nullptr; // The buffer that needs decrypting/decoding. scoped_refptr pending_buffer_to_decode_; @@ -108,11 +108,11 @@ class MEDIA_EXPORT DecryptingVideoDecoder : public VideoDecoder { // If this variable is true and kNoKey is returned then we need to try // decrypting/decoding again in case the newly added key is the correct // decryption key. - bool key_added_while_decode_pending_; + bool key_added_while_decode_pending_ = false; // Once Initialized() with encrypted content support, if the stream changes to // clear content, we want to ensure this decoder remains used. - bool support_clear_content_; + bool support_clear_content_ = false; base::WeakPtr weak_this_; base::WeakPtrFactory weak_factory_;