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

Side by Side Diff: media/test/pipeline_integration_test_base.h

Issue 1757593002: media: Update PipelineIntegrationTestBase to support MemoryDataSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | media/test/pipeline_integration_test_base.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 (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_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ 5 #ifndef MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_
6 #define MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ 6 #define MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/md5.h" 10 #include "base/md5.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // in the real AudioRendererImpl & SkCanvasVideoRenderer implementations used in 56 // in the real AudioRendererImpl & SkCanvasVideoRenderer implementations used in
57 // the browser. The renderers in this test don't actually write data to a 57 // the browser. The renderers in this test don't actually write data to a
58 // display or audio device. Both of these devices are simulated since they have 58 // display or audio device. Both of these devices are simulated since they have
59 // little effect on verifying pipeline behavior and allow tests to run faster 59 // little effect on verifying pipeline behavior and allow tests to run faster
60 // than real-time. 60 // than real-time.
61 class PipelineIntegrationTestBase { 61 class PipelineIntegrationTestBase {
62 public: 62 public:
63 PipelineIntegrationTestBase(); 63 PipelineIntegrationTestBase();
64 virtual ~PipelineIntegrationTestBase(); 64 virtual ~PipelineIntegrationTestBase();
65 65
66 bool WaitUntilOnEnded(); 66 // Test types for advanced testing and benchmarking (e.g., underflow is
67 PipelineStatus WaitUntilEndedOrError(); 67 // disabled to ensure consistent hashes). May be combined using the bitwise
68 // or operator (and as such must have values that are powers of two).
69 enum TestTypeFlags { kNormal = 0, kHashed = 1, kClockless = 2 };
68 70
69 // Starts the pipeline (optionally with a CdmContext), returning the final 71 // Starts the pipeline with a file specified by |filename|, optionally with a
70 // status code after it has started. |filename| points at a test file located 72 // CdmContext or a |test_type|, returning the final status code after it has
71 // under media/test/data/. 73 // started. |filename| points at a test file located under media/test/data/.
72 PipelineStatus Start(const std::string& filename); 74 PipelineStatus Start(const std::string& filename);
73 PipelineStatus Start(const std::string& filename, CdmContext* cdm_context); 75 PipelineStatus Start(const std::string& filename, CdmContext* cdm_context);
76 PipelineStatus Start(const std::string& filename, uint8_t test_type);
74 77
75 // Starts the pipeline in a particular mode for advanced testing and 78 // Starts the pipeline with |data| (with |size| bytes). The |data| will be
76 // benchmarking purposes (e.g., underflow is disabled to ensure consistent 79 // valid throughtout the lifetime of this test.
77 // hashes). May be combined using the bitwise or operator (and as such must 80 PipelineStatus Start(const uint8_t* data, size_t size, uint8_t test_type);
78 // have values that are powers of two).
79 enum TestTypeFlags { kHashed = 1, kClockless = 2 };
80 PipelineStatus Start(const std::string& filename, uint8_t test_type);
81 81
82 void Play(); 82 void Play();
83 void Pause(); 83 void Pause();
84 bool Seek(base::TimeDelta seek_time); 84 bool Seek(base::TimeDelta seek_time);
85 bool Suspend(); 85 bool Suspend();
86 bool Resume(base::TimeDelta seek_time); 86 bool Resume(base::TimeDelta seek_time);
87 void Stop(); 87 void Stop();
88 bool WaitUntilCurrentTimeIsAfter(const base::TimeDelta& wait_time); 88 bool WaitUntilCurrentTimeIsAfter(const base::TimeDelta& wait_time);
89 89
90 bool WaitUntilOnEnded();
91 PipelineStatus WaitUntilEndedOrError();
92
90 // Returns the MD5 hash of all video frames seen. Should only be called once 93 // Returns the MD5 hash of all video frames seen. Should only be called once
91 // after playback completes. First time hashes should be generated with 94 // after playback completes. First time hashes should be generated with
92 // --video-threads=1 to ensure correctness. Pipeline must have been started 95 // --video-threads=1 to ensure correctness. Pipeline must have been started
93 // with hashing enabled. 96 // with hashing enabled.
94 std::string GetVideoHash(); 97 std::string GetVideoHash();
95 98
96 // Returns the hash of all audio frames seen. Should only be called once 99 // Returns the hash of all audio frames seen. Should only be called once
97 // after playback completes. Pipeline must have been started with hashing 100 // after playback completes. Pipeline must have been started with hashing
98 // enabled. 101 // enabled.
99 std::string GetAudioHash(); 102 std::string GetAudioHash();
(...skipping 15 matching lines...) Expand all
115 scoped_ptr<NullVideoSink> video_sink_; 118 scoped_ptr<NullVideoSink> video_sink_;
116 bool ended_; 119 bool ended_;
117 PipelineStatus pipeline_status_; 120 PipelineStatus pipeline_status_;
118 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_; 121 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_;
119 VideoPixelFormat last_video_frame_format_; 122 VideoPixelFormat last_video_frame_format_;
120 ColorSpace last_video_frame_color_space_; 123 ColorSpace last_video_frame_color_space_;
121 DummyTickClock dummy_clock_; 124 DummyTickClock dummy_clock_;
122 AudioHardwareConfig hardware_config_; 125 AudioHardwareConfig hardware_config_;
123 PipelineMetadata metadata_; 126 PipelineMetadata metadata_;
124 127
128 PipelineStatus StartInternal(scoped_ptr<DataSource> data_source,
129 CdmContext* cdm_context,
130 uint8_t test_type);
131
132 PipelineStatus StartWithFile(const std::string& filename,
133 CdmContext* cdm_context,
134 uint8_t test_type);
135
125 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status); 136 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status);
126 void OnStatusCallback(PipelineStatus status); 137 void OnStatusCallback(PipelineStatus status);
127 void DemuxerEncryptedMediaInitDataCB(EmeInitDataType type, 138 void DemuxerEncryptedMediaInitDataCB(EmeInitDataType type,
128 const std::vector<uint8_t>& init_data); 139 const std::vector<uint8_t>& init_data);
129 void set_encrypted_media_init_data_cb( 140 void set_encrypted_media_init_data_cb(
130 const Demuxer::EncryptedMediaInitDataCB& encrypted_media_init_data_cb) { 141 const Demuxer::EncryptedMediaInitDataCB& encrypted_media_init_data_cb) {
131 encrypted_media_init_data_cb_ = encrypted_media_init_data_cb; 142 encrypted_media_init_data_cb_ = encrypted_media_init_data_cb;
132 } 143 }
133 144
134 void OnEnded(); 145 void OnEnded();
135 void OnError(PipelineStatus status); 146 void OnError(PipelineStatus status);
136 void QuitAfterCurrentTimeTask(const base::TimeDelta& quit_time); 147 void QuitAfterCurrentTimeTask(const base::TimeDelta& quit_time);
137 148
138 // Creates Demuxer and sets |demuxer_|. 149 // Creates Demuxer and sets |demuxer_|.
139 void CreateDemuxer(const std::string& filename); 150 void CreateDemuxer(scoped_ptr<DataSource> data_source);
140 151
141 // Creates and returns a Renderer. 152 // Creates and returns a Renderer.
142 virtual scoped_ptr<Renderer> CreateRenderer(); 153 virtual scoped_ptr<Renderer> CreateRenderer();
143 154
144 void OnVideoFramePaint(const scoped_refptr<VideoFrame>& frame); 155 void OnVideoFramePaint(const scoped_refptr<VideoFrame>& frame);
145 156
146 MOCK_METHOD1(OnMetadata, void(PipelineMetadata)); 157 MOCK_METHOD1(OnMetadata, void(PipelineMetadata));
147 MOCK_METHOD1(OnBufferingStateChanged, void(BufferingState)); 158 MOCK_METHOD1(OnBufferingStateChanged, void(BufferingState));
148 MOCK_METHOD1(DecryptorAttached, void(bool)); 159 MOCK_METHOD1(DecryptorAttached, void(bool));
149 MOCK_METHOD2(OnAddTextTrack, 160 MOCK_METHOD2(OnAddTextTrack,
150 void(const TextTrackConfig& config, 161 void(const TextTrackConfig& config,
151 const AddTextTrackDoneCB& done_cb)); 162 const AddTextTrackDoneCB& done_cb));
152 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); 163 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void));
153 }; 164 };
154 165
155 } // namespace media 166 } // namespace media
156 167
157 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ 168 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_
OLDNEW
« no previous file with comments | « no previous file | media/test/pipeline_integration_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698