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

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

Issue 165733002: Add DecryptingDemuxerStream::Stop(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months 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
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"
(...skipping 18 matching lines...) Expand all
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::SingleThreadTaskRunner>& task_runner, 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. If in
40 // |this| to kUninitialized state if |this| hasn't been initialized, or to 40 // kPendingDemuxerRead or kPendingDecrypt state, waits for the pending
41 // kIdle state otherwise. 41 // operation to finish before satisfying |closure|. Sets the state to
42 // kUninitialized if |this| hasn't been initialized, or to kIdle otherwise.
42 void Reset(const base::Closure& closure); 43 void Reset(const base::Closure& closure);
43 44
45 // Cancels all pending operations immediately and fires all pending callbacks
46 // and sets the state to kStopped. Does NOT wait for any pending operations.
47 // Note: During the teardown process, media pipeline will be waiting on the
48 // render main thread. If a Decryptor depends on the render main thread
49 // (e.g. PpapiDecryptor), the pending DecryptCB would not be satisfied.
50 void Stop(const base::Closure& closure);
51
44 // DemuxerStream implementation. 52 // DemuxerStream implementation.
45 virtual void Read(const ReadCB& read_cb) OVERRIDE; 53 virtual void Read(const ReadCB& read_cb) OVERRIDE;
46 virtual AudioDecoderConfig audio_decoder_config() OVERRIDE; 54 virtual AudioDecoderConfig audio_decoder_config() OVERRIDE;
47 virtual VideoDecoderConfig video_decoder_config() OVERRIDE; 55 virtual VideoDecoderConfig video_decoder_config() OVERRIDE;
48 virtual Type type() OVERRIDE; 56 virtual Type type() OVERRIDE;
49 virtual void EnableBitstreamConverter() OVERRIDE; 57 virtual void EnableBitstreamConverter() OVERRIDE;
50 58
51 private: 59 private:
52 // For a detailed state diagram please see this link: http://goo.gl/8jAok 60 // For a detailed state diagram please see this link: http://goo.gl/8jAok
53 // TODO(xhwang): Add a ASCII state diagram in this file after this class 61 // TODO(xhwang): Add a ASCII state diagram in this file after this class
54 // stabilizes. 62 // stabilizes.
55 // TODO(xhwang): Update this diagram for DecryptingDemuxerStream. 63 // TODO(xhwang): Update this diagram for DecryptingDemuxerStream.
56 enum State { 64 enum State {
57 kUninitialized = 0, 65 kUninitialized = 0,
58 kDecryptorRequested, 66 kDecryptorRequested,
59 kIdle, 67 kIdle,
60 kPendingDemuxerRead, 68 kPendingDemuxerRead,
61 kPendingDecrypt, 69 kPendingDecrypt,
62 kWaitingForKey, 70 kWaitingForKey,
71 kStopped
63 }; 72 };
64 73
65 // Callback for DecryptorHost::RequestDecryptor(). 74 // Callback for DecryptorHost::RequestDecryptor().
66 void SetDecryptor(Decryptor* decryptor); 75 void SetDecryptor(Decryptor* decryptor);
67 76
68 // Callback for DemuxerStream::Read(). 77 // Callback for DemuxerStream::Read().
69 void DecryptBuffer(DemuxerStream::Status status, 78 void DecryptBuffer(DemuxerStream::Status status,
70 const scoped_refptr<DecoderBuffer>& buffer); 79 const scoped_refptr<DecoderBuffer>& buffer);
71 80
72 void DecryptPendingBuffer(); 81 void DecryptPendingBuffer();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // If this variable is true and kNoKey is returned then we need to try 127 // 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. 128 // decrypting again in case the newly added key is the correct decryption key.
120 bool key_added_while_decrypt_pending_; 129 bool key_added_while_decrypt_pending_;
121 130
122 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream); 131 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream);
123 }; 132 };
124 133
125 } // namespace media 134 } // namespace media
126 135
127 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ 136 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698