OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROMECAST_MEDIA_CMA_TEST_MEDIA_COMPONENT_DEVICE_FEEDER_FOR_TEST_H_ | |
6 #define CHROMECAST_MEDIA_CMA_TEST_MEDIA_COMPONENT_DEVICE_FEEDER_FOR_TEST_H_ | |
7 | |
8 #include <list> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/callback.h" | |
13 #include "base/memory/ref_counted.h" | |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "base/time/time.h" | |
16 #include "chromecast/public/media/audio_pipeline_device.h" | |
17 #include "chromecast/public/media/cast_decoder_buffer.h" | |
18 #include "chromecast/public/media/media_clock_device.h" | |
19 #include "chromecast/public/media/video_pipeline_device.h" | |
20 | |
21 namespace chromecast { | |
22 namespace media { | |
23 class DecoderBufferBase; | |
24 | |
25 typedef std::list<scoped_refptr<DecoderBufferBase> > BufferList; | |
26 | |
27 class MediaComponentDeviceFeederForTest { | |
28 public: | |
29 MediaComponentDeviceFeederForTest( | |
30 MediaComponentDevice *device, | |
31 const BufferList& frames); | |
32 | |
33 virtual ~MediaComponentDeviceFeederForTest(); | |
34 | |
35 void Initialize(const base::Closure& eos_cb); | |
36 | |
37 // Feeds one frame into the pipeline. | |
38 void Feed(); | |
39 | |
40 private: | |
41 void OnFramePushed(MediaComponentDevice::FrameStatus status); | |
42 | |
43 void OnEos(); | |
44 | |
45 MediaComponentDevice *media_component_device_; | |
46 BufferList frames_; | |
47 | |
48 // Frame index where the audio device is switching to the kStateRunning. | |
49 int rendering_frame_idx_; | |
50 | |
51 // Frame index where the clock device is switching to the kStateRunning. | |
52 int clock_frame_idx_; | |
53 | |
54 // Timing pattern to feed the pipeline. | |
55 std::vector<base::TimeDelta> delayed_feed_pattern_; | |
56 size_t delayed_feed_pattern_idx_; | |
57 | |
58 base::Closure eos_cb_; | |
59 | |
60 bool feeding_completed_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(MediaComponentDeviceFeederForTest); | |
63 }; | |
64 | |
65 } // namespace media | |
66 } // namespace chromecast | |
67 | |
68 #endif // CHROMECAST_MEDIA_CMA_TEST_MEDIA_COMPONENT_DEVICE_FEEDER_FOR_TEST_H_ | |
OLD | NEW |