Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(909)

Side by Side Diff: media/filters/decrypting_demuxer_stream.h

Issue 65803002: Replace MessageLoopProxy with SingleThreadTaskRunner for media/filters/ + associated code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/filters/decrypting_audio_decoder.cc ('k') | media/filters/decrypting_demuxer_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ 5 #ifndef MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_
6 #define MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ 6 #define MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "media/base/audio_decoder_config.h" 11 #include "media/base/audio_decoder_config.h"
12 #include "media/base/decryptor.h" 12 #include "media/base/decryptor.h"
13 #include "media/base/demuxer_stream.h" 13 #include "media/base/demuxer_stream.h"
14 #include "media/base/pipeline_status.h" 14 #include "media/base/pipeline_status.h"
15 #include "media/base/video_decoder_config.h" 15 #include "media/base/video_decoder_config.h"
16 16
17 namespace base { 17 namespace base {
18 class MessageLoopProxy; 18 class SingleThreadTaskRunner;
19 } 19 }
20 20
21 namespace media { 21 namespace media {
22 22
23 class DecoderBuffer; 23 class DecoderBuffer;
24 24
25 // Decryptor-based DemuxerStream implementation that converts a potentially 25 // Decryptor-based DemuxerStream implementation that converts a potentially
26 // encrypted demuxer stream to a clear demuxer stream. 26 // encrypted demuxer stream to a clear demuxer stream.
27 // All public APIs and callbacks are trampolined to the |message_loop_| so 27 // All public APIs and callbacks are trampolined to the |task_runner_| so
28 // that no locks are required for thread safety. 28 // that no locks are required for thread safety.
29 class MEDIA_EXPORT DecryptingDemuxerStream : public DemuxerStream { 29 class MEDIA_EXPORT DecryptingDemuxerStream : public DemuxerStream {
30 public: 30 public:
31 DecryptingDemuxerStream( 31 DecryptingDemuxerStream(
32 const scoped_refptr<base::MessageLoopProxy>& message_loop, 32 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
33 const SetDecryptorReadyCB& set_decryptor_ready_cb); 33 const SetDecryptorReadyCB& set_decryptor_ready_cb);
34 virtual ~DecryptingDemuxerStream(); 34 virtual ~DecryptingDemuxerStream();
35 35
36 void Initialize(DemuxerStream* stream, 36 void Initialize(DemuxerStream* stream,
37 const PipelineStatusCB& status_cb); 37 const PipelineStatusCB& status_cb);
38 38
39 // Cancels all pending operations and fires all pending callbacks. Sets 39 // Cancels all pending operations and fires all pending callbacks. Sets
40 // |this| to kUninitialized state if |this| hasn't been initialized, or to 40 // |this| to kUninitialized state if |this| hasn't been initialized, or to
41 // kIdle state otherwise. 41 // kIdle state otherwise.
42 void Reset(const base::Closure& closure); 42 void Reset(const base::Closure& closure);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Resets decoder and calls |reset_cb_|. 82 // Resets decoder and calls |reset_cb_|.
83 void DoReset(); 83 void DoReset();
84 84
85 // Returns Decryptor::StreamType converted from |stream_type_|. 85 // Returns Decryptor::StreamType converted from |stream_type_|.
86 Decryptor::StreamType GetDecryptorStreamType() const; 86 Decryptor::StreamType GetDecryptorStreamType() const;
87 87
88 // Creates and initializes either |audio_config_| or |video_config_| based on 88 // Creates and initializes either |audio_config_| or |video_config_| based on
89 // |demuxer_stream_|. 89 // |demuxer_stream_|.
90 void InitializeDecoderConfig(); 90 void InitializeDecoderConfig();
91 91
92 scoped_refptr<base::MessageLoopProxy> message_loop_; 92 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
93 base::WeakPtrFactory<DecryptingDemuxerStream> weak_factory_; 93 base::WeakPtrFactory<DecryptingDemuxerStream> weak_factory_;
94 base::WeakPtr<DecryptingDemuxerStream> weak_this_; 94 base::WeakPtr<DecryptingDemuxerStream> weak_this_;
95 95
96 State state_; 96 State state_;
97 97
98 PipelineStatusCB init_cb_; 98 PipelineStatusCB init_cb_;
99 ReadCB read_cb_; 99 ReadCB read_cb_;
100 base::Closure reset_cb_; 100 base::Closure reset_cb_;
101 101
102 // Pointer to the input demuxer stream that will feed us encrypted buffers. 102 // Pointer to the input demuxer stream that will feed us encrypted buffers.
(...skipping 15 matching lines...) Expand all
118 // If this variable is true and kNoKey is returned then we need to try 118 // If this variable is true and kNoKey is returned then we need to try
119 // decrypting again in case the newly added key is the correct decryption key. 119 // decrypting again in case the newly added key is the correct decryption key.
120 bool key_added_while_decrypt_pending_; 120 bool key_added_while_decrypt_pending_;
121 121
122 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream); 122 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream);
123 }; 123 };
124 124
125 } // namespace media 125 } // namespace media
126 126
127 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ 127 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_
OLDNEW
« no previous file with comments | « media/filters/decrypting_audio_decoder.cc ('k') | media/filters/decrypting_demuxer_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698