| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BASE_ANDROID_TEST_DATA_FACTORY_H_ | 5 #ifndef MEDIA_BASE_ANDROID_TEST_DATA_FACTORY_H_ |
| 6 #define MEDIA_BASE_ANDROID_TEST_DATA_FACTORY_H_ | 6 #define MEDIA_BASE_ANDROID_TEST_DATA_FACTORY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // The |%d| will be replaced by 0, 1, 2, 3. | 31 // The |%d| will be replaced by 0, 1, 2, 3. |
| 32 // duration: after the last AU exceeds duration the factory generates EOS | 32 // duration: after the last AU exceeds duration the factory generates EOS |
| 33 // unit and stops. | 33 // unit and stops. |
| 34 // frame_period: PTS increment between units. | 34 // frame_period: PTS increment between units. |
| 35 TestDataFactory(const char* file_name_template, | 35 TestDataFactory(const char* file_name_template, |
| 36 const base::TimeDelta& duration, | 36 const base::TimeDelta& duration, |
| 37 const base::TimeDelta& frame_period); | 37 const base::TimeDelta& frame_period); |
| 38 virtual ~TestDataFactory(); | 38 virtual ~TestDataFactory(); |
| 39 | 39 |
| 40 // Returns demuxer configuration for this factory. | 40 // Returns demuxer configuration for this factory. |
| 41 virtual DemuxerConfigs GetConfigs() = 0; | 41 virtual DemuxerConfigs GetConfigs() const = 0; |
| 42 | 42 |
| 43 // Populates next chunk and the corresponding delay. | 43 // Populates next chunk and the corresponding delay. |
| 44 // Default implementation repeatedly uses |packet_| array in order 0-1-2-3 | 44 // Default implementation repeatedly uses |packet_| array in order 0-1-2-3 |
| 45 // and monotonically increases timestamps from 0 to |duration_|. | 45 // and monotonically increases timestamps from 0 to |duration_|. |
| 46 // The first unit to exceed |duration_| becomes EOS. The delay is set to 0. | 46 // The first unit to exceed |duration_| becomes EOS. The delay is set to 0. |
| 47 virtual void CreateChunk(DemuxerData* chunk, base::TimeDelta* delay); | 47 virtual void CreateChunk(DemuxerData* chunk, base::TimeDelta* delay); |
| 48 | 48 |
| 49 base::TimeDelta last_pts() const { return last_pts_; } | 49 base::TimeDelta last_pts() const { return last_pts_; } |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 // Called by constructor to load packets from files referred by | 52 // Called by constructor to load packets from files referred by |
| 53 // |file_name_template|. | 53 // |file_name_template|. |
| 54 virtual void LoadPackets(const char* file_name_template); | 54 virtual void LoadPackets(const char* file_name_template); |
| 55 | 55 |
| 56 // Used to modify the generated access unit by a subclass. | 56 // Used to modify the generated access unit by a subclass. |
| 57 virtual void ModifyAccessUnit(int index_in_chunk, AccessUnit* unit) {} | 57 virtual void ModifyAccessUnit(int index_in_chunk, AccessUnit* unit) {} |
| 58 | 58 |
| 59 base::TimeDelta duration_; | 59 base::TimeDelta duration_; |
| 60 base::TimeDelta frame_period_; | 60 base::TimeDelta frame_period_; |
| 61 std::vector<uint8_t> packet_[4]; | 61 std::vector<uint8_t> packet_[4]; |
| 62 base::TimeDelta regular_pts_; // monotonically increasing PTS | 62 base::TimeDelta regular_pts_; // monotonically increasing PTS |
| 63 base::TimeDelta last_pts_; // subclass can modify PTS, maintains the last | 63 base::TimeDelta last_pts_; // subclass can modify PTS, maintains the last |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 } // namespace media | 66 } // namespace media |
| 67 | 67 |
| 68 #endif // MEDIA_BASE_ANDROID_TEST_DATA_FACTORY_H_ | 68 #endif // MEDIA_BASE_ANDROID_TEST_DATA_FACTORY_H_ |
| OLD | NEW |