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

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

Issue 20136002: Reland r212023 "Rename VideoDecoder::ReadCB to VideoDecoder::DecodeCB." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix content_browsertests failure. Created 7 years, 4 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
« no previous file with comments | « media/filters/decrypting_video_decoder_unittest.cc ('k') | media/filters/fake_video_decoder.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_FAKE_VIDEO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ 6 #define MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 19 matching lines...) Expand all
30 class FakeVideoDecoder : public VideoDecoder { 30 class FakeVideoDecoder : public VideoDecoder {
31 public: 31 public:
32 // Constructs an object with a decoding delay of |decoding_delay| frames. 32 // Constructs an object with a decoding delay of |decoding_delay| frames.
33 explicit FakeVideoDecoder(int decoding_delay); 33 explicit FakeVideoDecoder(int decoding_delay);
34 virtual ~FakeVideoDecoder(); 34 virtual ~FakeVideoDecoder();
35 35
36 // VideoDecoder implementation. 36 // VideoDecoder implementation.
37 virtual void Initialize(const VideoDecoderConfig& config, 37 virtual void Initialize(const VideoDecoderConfig& config,
38 const PipelineStatusCB& status_cb) OVERRIDE; 38 const PipelineStatusCB& status_cb) OVERRIDE;
39 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, 39 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
40 const ReadCB& read_cb) OVERRIDE; 40 const DecodeCB& decode_cb) OVERRIDE;
41 virtual void Reset(const base::Closure& closure) OVERRIDE; 41 virtual void Reset(const base::Closure& closure) OVERRIDE;
42 virtual void Stop(const base::Closure& closure) OVERRIDE; 42 virtual void Stop(const base::Closure& closure) OVERRIDE;
43 43
44 // Holds the next init/read/reset/stop callback from firing. 44 // Holds the next init/read/reset/stop callback from firing.
45 void HoldNextInit(); 45 void HoldNextInit();
46 void HoldNextRead(); 46 void HoldNextRead();
47 void HoldNextReset(); 47 void HoldNextReset();
48 void HoldNextStop(); 48 void HoldNextStop();
49 49
50 // Satisfies the pending init/read/reset/stop callback, which must be ready 50 // Satisfies the pending init/read/reset/stop callback, which must be ready
51 // to fire when these methods are called. 51 // to fire when these methods are called.
52 void SatisfyInit(); 52 void SatisfyInit();
53 void SatisfyRead(); 53 void SatisfyRead();
54 void SatisfyReset(); 54 void SatisfyReset();
55 void SatisfyStop(); 55 void SatisfyStop();
56 56
57 int total_bytes_decoded() const { return total_bytes_decoded_; } 57 int total_bytes_decoded() const { return total_bytes_decoded_; }
58 58
59 private: 59 private:
60 enum State { 60 enum State {
61 UNINITIALIZED, 61 UNINITIALIZED,
62 NORMAL 62 NORMAL
63 }; 63 };
64 64
65 // Callback for updating |total_bytes_decoded_|. 65 // Callback for updating |total_bytes_decoded_|.
66 void OnFrameDecoded(int buffer_size, 66 void OnFrameDecoded(int buffer_size,
67 const ReadCB& read_cb, 67 const DecodeCB& read_cb,
68 Status status, 68 Status status,
69 const scoped_refptr<VideoFrame>& video_frame); 69 const scoped_refptr<VideoFrame>& video_frame);
70 70
71 void DoReset(); 71 void DoReset();
72 void DoStop(); 72 void DoStop();
73 73
74 scoped_refptr<base::MessageLoopProxy> message_loop_; 74 scoped_refptr<base::MessageLoopProxy> message_loop_;
75 base::WeakPtrFactory<FakeVideoDecoder> weak_factory_; 75 base::WeakPtrFactory<FakeVideoDecoder> weak_factory_;
76 base::WeakPtr<FakeVideoDecoder> weak_this_; 76 base::WeakPtr<FakeVideoDecoder> weak_this_;
77 77
78 const int decoding_delay_; 78 const int decoding_delay_;
79 79
80 State state_; 80 State state_;
81 81
82 CallbackHolder<PipelineStatusCB> init_cb_; 82 CallbackHolder<PipelineStatusCB> init_cb_;
83 CallbackHolder<ReadCB> read_cb_; 83 CallbackHolder<DecodeCB> decode_cb_;
84 CallbackHolder<base::Closure> reset_cb_; 84 CallbackHolder<base::Closure> reset_cb_;
85 CallbackHolder<base::Closure> stop_cb_; 85 CallbackHolder<base::Closure> stop_cb_;
86 86
87 VideoDecoderConfig current_config_; 87 VideoDecoderConfig current_config_;
88 88
89 std::list<scoped_refptr<VideoFrame> > decoded_frames_; 89 std::list<scoped_refptr<VideoFrame> > decoded_frames_;
90 90
91 int total_bytes_decoded_; 91 int total_bytes_decoded_;
92 92
93 DISALLOW_COPY_AND_ASSIGN(FakeVideoDecoder); 93 DISALLOW_COPY_AND_ASSIGN(FakeVideoDecoder);
94 }; 94 };
95 95
96 } // namespace media 96 } // namespace media
97 97
98 #endif // MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ 98 #endif // MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « media/filters/decrypting_video_decoder_unittest.cc ('k') | media/filters/fake_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698