Skip to content

Commit

Permalink
media: Misc cleanup in Decrypting{Audio,Video}Decoder
Browse files Browse the repository at this point in the history
No functionality change.

Change-Id: I4c28ac1c1944cbb2cd8e274c578ff45ec6e715b8
Reviewed-on: https://chromium-review.googlesource.com/c/1409848
Reviewed-by: John Rummell <jrummell@chromium.org>
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#622684}
  • Loading branch information
xhwang-chromium authored and Commit Bot committed Jan 15, 2019
1 parent 23704db commit 661e522
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 28 deletions.
8 changes: 1 addition & 7 deletions media/filters/decrypting_audio_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ static inline bool IsOutOfSync(const base::TimeDelta& timestamp_1,
DecryptingAudioDecoder::DecryptingAudioDecoder(
const scoped_refptr<base::SingleThreadTaskRunner>& 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";
Expand Down
14 changes: 7 additions & 7 deletions media/filters/decrypting_audio_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<base::SingleThreadTaskRunner> task_runner_;
// Set in constructor.
scoped_refptr<base::SingleThreadTaskRunner> const task_runner_;
MediaLog* const media_log_;

MediaLog* media_log_;

State state_;
State state_ = kUninitialized;

InitCB init_cb_;
OutputCB output_cb_;
Expand All @@ -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<media::DecoderBuffer> pending_buffer_to_decode_;
Expand All @@ -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<AudioTimestampHelper> 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<DecryptingAudioDecoder> weak_this_;
base::WeakPtrFactory<DecryptingAudioDecoder> weak_factory_;
Expand Down
8 changes: 1 addition & 7 deletions media/filters/decrypting_video_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ const char DecryptingVideoDecoder::kDecoderName[] = "DecryptingVideoDecoder";
DecryptingVideoDecoder::DecryptingVideoDecoder(
const scoped_refptr<base::SingleThreadTaskRunner>& 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;
Expand Down
14 changes: 7 additions & 7 deletions media/filters/decrypting_video_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ class MEDIA_EXPORT DecryptingVideoDecoder : public VideoDecoder {
void CompletePendingDecode(Decryptor::Status status);
void CompleteWaitingForDecryptionKey();

scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
// Set in constructor.
scoped_refptr<base::SingleThreadTaskRunner> const task_runner_;
MediaLog* const media_log_;

MediaLog* media_log_;

State state_;
State state_ = kUninitialized;

InitCB init_cb_;
OutputCB output_cb_;
Expand All @@ -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<media::DecoderBuffer> pending_buffer_to_decode_;
Expand All @@ -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<DecryptingVideoDecoder> weak_this_;
base::WeakPtrFactory<DecryptingVideoDecoder> weak_factory_;
Expand Down

0 comments on commit 661e522

Please sign in to comment.