Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 22 matching lines...) Expand all Loading... | |
| 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 DecodeCB& decode_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 virtual scoped_refptr<VideoFrame> GetDecodeOutput() OVERRIDE; | |
| 44 | |
| 45 // Queue up a VideoFrame to be returned by GetDecodeOutput(). | |
| 46 void QueueRead(); | |
|
xhwang
2014/03/06 23:32:40
You probably also need to update fake_video_decode
| |
| 43 | 47 |
| 44 // Holds the next init/read/reset/stop callback from firing. | 48 // Holds the next init/read/reset/stop callback from firing. |
| 45 void HoldNextInit(); | 49 void HoldNextInit(); |
| 46 void HoldNextRead(); | 50 void HoldNextRead(); |
| 47 void HoldNextReset(); | 51 void HoldNextReset(); |
| 48 void HoldNextStop(); | 52 void HoldNextStop(); |
| 49 | 53 |
| 50 // Satisfies the pending init/read/reset/stop callback, which must be ready | 54 // Satisfies the pending init/read/reset/stop callback, which must be ready |
| 51 // to fire when these methods are called. | 55 // to fire when these methods are called. |
| 52 void SatisfyInit(); | 56 void SatisfyInit(); |
| 53 void SatisfyRead(); | 57 void SatisfyRead(); |
|
xhwang
2014/03/06 23:32:40
We should replace all "read" with "decode" in anot
| |
| 54 void SatisfyReset(); | 58 void SatisfyReset(); |
| 55 void SatisfyStop(); | 59 void SatisfyStop(); |
| 56 | 60 |
| 57 int total_bytes_decoded() const { return total_bytes_decoded_; } | 61 int total_bytes_decoded() const { return total_bytes_decoded_; } |
| 62 int reads_queued() const { return reads_queued_; } | |
| 58 | 63 |
| 59 private: | 64 private: |
| 60 enum State { | 65 enum State { |
| 61 UNINITIALIZED, | 66 UNINITIALIZED, |
| 62 NORMAL | 67 NORMAL |
| 63 }; | 68 }; |
| 64 | 69 |
| 65 // Callback for updating |total_bytes_decoded_|. | 70 // Callback for updating |total_bytes_decoded_|. |
| 66 void OnFrameDecoded(int buffer_size, | 71 void OnFrameDecoded(int buffer_size, |
| 67 const DecodeCB& read_cb, | 72 const DecodeCB& read_cb, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 83 CallbackHolder<DecodeCB> decode_cb_; | 88 CallbackHolder<DecodeCB> decode_cb_; |
| 84 CallbackHolder<base::Closure> reset_cb_; | 89 CallbackHolder<base::Closure> reset_cb_; |
| 85 CallbackHolder<base::Closure> stop_cb_; | 90 CallbackHolder<base::Closure> stop_cb_; |
| 86 | 91 |
| 87 VideoDecoderConfig current_config_; | 92 VideoDecoderConfig current_config_; |
| 88 | 93 |
| 89 std::list<scoped_refptr<VideoFrame> > decoded_frames_; | 94 std::list<scoped_refptr<VideoFrame> > decoded_frames_; |
| 90 | 95 |
| 91 int total_bytes_decoded_; | 96 int total_bytes_decoded_; |
| 92 | 97 |
| 98 int reads_queued_; | |
| 99 | |
| 93 DISALLOW_COPY_AND_ASSIGN(FakeVideoDecoder); | 100 DISALLOW_COPY_AND_ASSIGN(FakeVideoDecoder); |
| 94 }; | 101 }; |
| 95 | 102 |
| 96 } // namespace media | 103 } // namespace media |
| 97 | 104 |
| 98 #endif // MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ | 105 #endif // MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ |
| OLD | NEW |