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

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

Issue 2448763002: FFmpegDemuxer: Clear |extra_data| when enabling bitstream conversion. (Closed)
Patch Set: Restore variant used by fuzzertest. Created 4 years, 1 month 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 | « media/test/pipeline_integration_test.cc ('k') | 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 #include <memory> 9 #include <memory>
10 10
11 #include "base/md5.h" 11 #include "base/md5.h"
12 #include "base/memory/scoped_vector.h"
12 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
13 #include "media/audio/clockless_audio_sink.h" 14 #include "media/audio/clockless_audio_sink.h"
14 #include "media/audio/null_audio_sink.h" 15 #include "media/audio/null_audio_sink.h"
15 #include "media/base/demuxer.h" 16 #include "media/base/demuxer.h"
16 #include "media/base/media_keys.h" 17 #include "media/base/media_keys.h"
17 #include "media/base/null_video_sink.h" 18 #include "media/base/null_video_sink.h"
18 #include "media/base/pipeline_impl.h" 19 #include "media/base/pipeline_impl.h"
19 #include "media/base/pipeline_status.h" 20 #include "media/base/pipeline_status.h"
20 #include "media/base/text_track.h" 21 #include "media/base/text_track.h"
21 #include "media/base/text_track_config.h" 22 #include "media/base/text_track_config.h"
22 #include "media/base/video_frame.h" 23 #include "media/base/video_frame.h"
23 #include "media/renderers/video_renderer_impl.h" 24 #include "media/renderers/video_renderer_impl.h"
24 #include "testing/gmock/include/gmock/gmock.h" 25 #include "testing/gmock/include/gmock/gmock.h"
25 26
26 namespace base { 27 namespace base {
27 class FilePath; 28 class FilePath;
28 } 29 }
29 30
30 namespace media { 31 namespace media {
31 32
33 class AudioDecoder;
32 class CdmContext; 34 class CdmContext;
35 class VideoDecoder;
33 36
34 // Empty MD5 hash string. Used to verify empty video tracks. 37 // Empty MD5 hash string. Used to verify empty video tracks.
35 extern const char kNullVideoHash[]; 38 extern const char kNullVideoHash[];
36 39
37 // Empty hash string. Used to verify empty audio tracks. 40 // Empty hash string. Used to verify empty audio tracks.
38 extern const char kNullAudioHash[]; 41 extern const char kNullAudioHash[];
39 42
40 // Dummy tick clock which advances extremely quickly (1 minute every time 43 // Dummy tick clock which advances extremely quickly (1 minute every time
41 // NowTicks() is called). 44 // NowTicks() is called).
42 class DummyTickClock : public base::TickClock { 45 class DummyTickClock : public base::TickClock {
(...skipping 28 matching lines...) Expand all
71 kHashed = 1, 74 kHashed = 1,
72 kClockless = 2, 75 kClockless = 2,
73 kExpectDemuxerFailure = 4 76 kExpectDemuxerFailure = 4
74 }; 77 };
75 78
76 // Starts the pipeline with a file specified by |filename|, optionally with a 79 // Starts the pipeline with a file specified by |filename|, optionally with a
77 // CdmContext or a |test_type|, returning the final status code after it has 80 // CdmContext or a |test_type|, returning the final status code after it has
78 // started. |filename| points at a test file located under media/test/data/. 81 // started. |filename| points at a test file located under media/test/data/.
79 PipelineStatus Start(const std::string& filename); 82 PipelineStatus Start(const std::string& filename);
80 PipelineStatus Start(const std::string& filename, CdmContext* cdm_context); 83 PipelineStatus Start(const std::string& filename, CdmContext* cdm_context);
81 PipelineStatus Start(const std::string& filename, uint8_t test_type); 84 PipelineStatus Start(const std::string& filename,
85 uint8_t test_type,
86 ScopedVector<VideoDecoder> prepend_video_decoders =
87 ScopedVector<VideoDecoder>(),
88 ScopedVector<AudioDecoder> prepend_audio_decoders =
89 ScopedVector<AudioDecoder>());
82 90
83 // Starts the pipeline with |data| (with |size| bytes). The |data| will be 91 // Starts the pipeline with |data| (with |size| bytes). The |data| will be
84 // valid throughtout the lifetime of this test. 92 // valid throughtout the lifetime of this test.
85 PipelineStatus Start(const uint8_t* data, size_t size, uint8_t test_type); 93 PipelineStatus Start(const uint8_t* data, size_t size, uint8_t test_type);
86 94
87 void Play(); 95 void Play();
88 void Pause(); 96 void Pause();
89 bool Seek(base::TimeDelta seek_time); 97 bool Seek(base::TimeDelta seek_time);
90 bool Suspend(); 98 bool Suspend();
91 bool Resume(base::TimeDelta seek_time); 99 bool Resume(base::TimeDelta seek_time);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 std::unique_ptr<NullVideoSink> video_sink_; 145 std::unique_ptr<NullVideoSink> video_sink_;
138 bool ended_; 146 bool ended_;
139 PipelineStatus pipeline_status_; 147 PipelineStatus pipeline_status_;
140 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_; 148 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_;
141 VideoPixelFormat last_video_frame_format_; 149 VideoPixelFormat last_video_frame_format_;
142 ColorSpace last_video_frame_color_space_; 150 ColorSpace last_video_frame_color_space_;
143 DummyTickClock dummy_clock_; 151 DummyTickClock dummy_clock_;
144 PipelineMetadata metadata_; 152 PipelineMetadata metadata_;
145 scoped_refptr<VideoFrame> last_frame_; 153 scoped_refptr<VideoFrame> last_frame_;
146 154
147 PipelineStatus StartInternal(std::unique_ptr<DataSource> data_source, 155 PipelineStatus StartInternal(
148 CdmContext* cdm_context, 156 std::unique_ptr<DataSource> data_source,
149 uint8_t test_type); 157 CdmContext* cdm_context,
158 uint8_t test_type,
159 ScopedVector<VideoDecoder> prepend_video_decoders =
160 ScopedVector<VideoDecoder>(),
161 ScopedVector<AudioDecoder> prepend_audio_decoders =
162 ScopedVector<AudioDecoder>());
150 163
151 PipelineStatus StartWithFile(const std::string& filename, 164 PipelineStatus StartWithFile(
152 CdmContext* cdm_context, 165 const std::string& filename,
153 uint8_t test_type); 166 CdmContext* cdm_context,
167 uint8_t test_type,
168 ScopedVector<VideoDecoder> prepend_video_decoders =
169 ScopedVector<VideoDecoder>(),
170 ScopedVector<AudioDecoder> prepend_audio_decoders =
171 ScopedVector<AudioDecoder>());
154 172
155 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status); 173 void OnSeeked(base::TimeDelta seek_time, PipelineStatus status);
156 void OnStatusCallback(PipelineStatus status); 174 void OnStatusCallback(PipelineStatus status);
157 void DemuxerEncryptedMediaInitDataCB(EmeInitDataType type, 175 void DemuxerEncryptedMediaInitDataCB(EmeInitDataType type,
158 const std::vector<uint8_t>& init_data); 176 const std::vector<uint8_t>& init_data);
159 177
160 void DemuxerMediaTracksUpdatedCB(std::unique_ptr<MediaTracks> tracks); 178 void DemuxerMediaTracksUpdatedCB(std::unique_ptr<MediaTracks> tracks);
161 179
162 void QuitAfterCurrentTimeTask(const base::TimeDelta& quit_time); 180 void QuitAfterCurrentTimeTask(const base::TimeDelta& quit_time);
163 181
164 // Creates Demuxer and sets |demuxer_|. 182 // Creates Demuxer and sets |demuxer_|.
165 void CreateDemuxer(std::unique_ptr<DataSource> data_source); 183 void CreateDemuxer(std::unique_ptr<DataSource> data_source);
166 184
167 // Creates and returns a Renderer. 185 // Creates and returns a Renderer.
168 virtual std::unique_ptr<Renderer> CreateRenderer(); 186 virtual std::unique_ptr<Renderer> CreateRenderer(
187 ScopedVector<VideoDecoder> prepend_video_decoders =
188 ScopedVector<VideoDecoder>(),
189 ScopedVector<AudioDecoder> prepend_audio_decoders =
190 ScopedVector<AudioDecoder>());
169 191
170 void OnVideoFramePaint(const scoped_refptr<VideoFrame>& frame); 192 void OnVideoFramePaint(const scoped_refptr<VideoFrame>& frame);
171 193
172 MOCK_METHOD1(DecryptorAttached, void(bool)); 194 MOCK_METHOD1(DecryptorAttached, void(bool));
173 // Pipeline::Client overrides. 195 // Pipeline::Client overrides.
174 void OnError(PipelineStatus status) override; 196 void OnError(PipelineStatus status) override;
175 void OnEnded() override; 197 void OnEnded() override;
176 MOCK_METHOD1(OnMetadata, void(PipelineMetadata)); 198 MOCK_METHOD1(OnMetadata, void(PipelineMetadata));
177 MOCK_METHOD1(OnBufferingStateChange, void(BufferingState)); 199 MOCK_METHOD1(OnBufferingStateChange, void(BufferingState));
178 MOCK_METHOD0(OnDurationChange, void()); 200 MOCK_METHOD0(OnDurationChange, void());
179 MOCK_METHOD2(OnAddTextTrack, 201 MOCK_METHOD2(OnAddTextTrack,
180 void(const TextTrackConfig& config, 202 void(const TextTrackConfig& config,
181 const AddTextTrackDoneCB& done_cb)); 203 const AddTextTrackDoneCB& done_cb));
182 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); 204 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void));
183 MOCK_METHOD1(OnVideoNaturalSizeChange, void(const gfx::Size&)); 205 MOCK_METHOD1(OnVideoNaturalSizeChange, void(const gfx::Size&));
184 MOCK_METHOD1(OnVideoOpacityChange, void(bool)); 206 MOCK_METHOD1(OnVideoOpacityChange, void(bool));
185 }; 207 };
186 208
187 } // namespace media 209 } // namespace media
188 210
189 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_ 211 #endif // MEDIA_TEST_PIPELINE_INTEGRATION_TEST_BASE_H_
OLDNEW
« no previous file with comments | « media/test/pipeline_integration_test.cc ('k') | media/test/pipeline_integration_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698