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

Side by Side Diff: media/cast/test/fake_media_source.h

Issue 2534193003: To M56: Roll src/third_party/ffmpeg/ 3c7a09882..cdf4accee (3188 commits). (Closed)
Patch Set: Created 4 years 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/base/media_file_checker.cc ('k') | media/cast/test/fake_media_source.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 2014 The Chromium Authors. All rights reserved. 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 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 // A fake media source that generates video and audio frames to a cast 5 // A fake media source that generates video and audio frames to a cast
6 // sender. 6 // sender.
7 // This class can transcode a WebM file using FFmpeg. It can also 7 // This class can transcode a WebM file using FFmpeg. It can also
8 // generate an animation and audio of fixed frequency. 8 // generate an animation and audio of fixed frequency.
9 9
10 #ifndef MEDIA_CAST_TEST_FAKE_MEDIA_SOURCE_H_ 10 #ifndef MEDIA_CAST_TEST_FAKE_MEDIA_SOURCE_H_
(...skipping 22 matching lines...) Expand all
33 namespace media { 33 namespace media {
34 34
35 class AudioBus; 35 class AudioBus;
36 class AudioConverter; 36 class AudioConverter;
37 class AudioFifo; 37 class AudioFifo;
38 class AudioTimestampHelper; 38 class AudioTimestampHelper;
39 class FFmpegGlue; 39 class FFmpegGlue;
40 class InMemoryUrlProtocol; 40 class InMemoryUrlProtocol;
41 class VideoFrame; 41 class VideoFrame;
42 42
43 struct ScopedPtrAVFreeContext;
44
43 namespace cast { 45 namespace cast {
44 46
45 class AudioFrameInput; 47 class AudioFrameInput;
46 class VideoFrameInput; 48 class VideoFrameInput;
47 class TestAudioBusFactory; 49 class TestAudioBusFactory;
48 50
49 class FakeMediaSource : public media::AudioConverter::InputCallback { 51 class FakeMediaSource : public media::AudioConverter::InputCallback {
50 public: 52 public:
51 // |task_runner| is to schedule decoding tasks. 53 // |task_runner| is to schedule decoding tasks.
52 // |clock| is used by this source but is not owned. 54 // |clock| is used by this source but is not owned.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void DecodeAudio(ScopedAVPacket packet); 108 void DecodeAudio(ScopedAVPacket packet);
107 void DecodeVideo(ScopedAVPacket packet); 109 void DecodeVideo(ScopedAVPacket packet);
108 void Decode(bool decode_audio); 110 void Decode(bool decode_audio);
109 111
110 // media::AudioConverter::InputCallback implementation. 112 // media::AudioConverter::InputCallback implementation.
111 double ProvideInput(media::AudioBus* output_bus, 113 double ProvideInput(media::AudioBus* output_bus,
112 uint32_t frames_delayed) final; 114 uint32_t frames_delayed) final;
113 115
114 AVStream* av_audio_stream(); 116 AVStream* av_audio_stream();
115 AVStream* av_video_stream(); 117 AVStream* av_video_stream();
116 AVCodecContext* av_audio_context();
117 AVCodecContext* av_video_context();
118 118
119 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 119 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
120 const media::AudioParameters output_audio_params_; 120 const media::AudioParameters output_audio_params_;
121 const FrameSenderConfig video_config_; 121 const FrameSenderConfig video_config_;
122 const bool keep_frames_; 122 const bool keep_frames_;
123 bool variable_frame_size_mode_; 123 bool variable_frame_size_mode_;
124 gfx::Size current_frame_size_; 124 gfx::Size current_frame_size_;
125 base::TimeTicks next_frame_size_change_time_; 125 base::TimeTicks next_frame_size_change_time_;
126 scoped_refptr<AudioFrameInput> audio_frame_input_; 126 scoped_refptr<AudioFrameInput> audio_frame_input_;
127 scoped_refptr<VideoFrameInput> video_frame_input_; 127 scoped_refptr<VideoFrameInput> video_frame_input_;
128 uint8_t synthetic_count_; 128 uint8_t synthetic_count_;
129 base::TickClock* const clock_; // Not owned by this class. 129 base::TickClock* const clock_; // Not owned by this class.
130 130
131 // Time when the stream starts. 131 // Time when the stream starts.
132 base::TimeTicks start_time_; 132 base::TimeTicks start_time_;
133 133
134 // The following three members are used only for fake frames. 134 // The following three members are used only for fake frames.
135 int audio_frame_count_; // Each audio frame is exactly 10ms. 135 int audio_frame_count_; // Each audio frame is exactly 10ms.
136 int video_frame_count_; 136 int video_frame_count_;
137 std::unique_ptr<TestAudioBusFactory> audio_bus_factory_; 137 std::unique_ptr<TestAudioBusFactory> audio_bus_factory_;
138 138
139 base::MemoryMappedFile file_data_; 139 base::MemoryMappedFile file_data_;
140 std::unique_ptr<InMemoryUrlProtocol> protocol_; 140 std::unique_ptr<InMemoryUrlProtocol> protocol_;
141 std::unique_ptr<FFmpegGlue> glue_; 141 std::unique_ptr<FFmpegGlue> glue_;
142 AVFormatContext* av_format_context_; 142 AVFormatContext* av_format_context_;
143 143
144 int audio_stream_index_; 144 int audio_stream_index_;
145 std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> av_audio_context_;
145 AudioParameters source_audio_params_; 146 AudioParameters source_audio_params_;
146 double playback_rate_; 147 double playback_rate_;
147 148
148 int video_stream_index_; 149 int video_stream_index_;
150 std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> av_video_context_;
149 int video_frame_rate_numerator_; 151 int video_frame_rate_numerator_;
150 int video_frame_rate_denominator_; 152 int video_frame_rate_denominator_;
151 153
152 // These are used for audio resampling. 154 // These are used for audio resampling.
153 std::unique_ptr<media::AudioConverter> audio_converter_; 155 std::unique_ptr<media::AudioConverter> audio_converter_;
154 std::unique_ptr<media::AudioFifo> audio_fifo_; 156 std::unique_ptr<media::AudioFifo> audio_fifo_;
155 std::unique_ptr<media::AudioBus> audio_fifo_input_bus_; 157 std::unique_ptr<media::AudioBus> audio_fifo_input_bus_;
156 media::AudioRendererAlgorithm audio_algo_; 158 media::AudioRendererAlgorithm audio_algo_;
157 159
158 // Track the timestamp of audio sent to the receiver. 160 // Track the timestamp of audio sent to the receiver.
(...skipping 10 matching lines...) Expand all
169 // NOTE: Weak pointers must be invalidated before all other member variables. 171 // NOTE: Weak pointers must be invalidated before all other member variables.
170 base::WeakPtrFactory<FakeMediaSource> weak_factory_; 172 base::WeakPtrFactory<FakeMediaSource> weak_factory_;
171 173
172 DISALLOW_COPY_AND_ASSIGN(FakeMediaSource); 174 DISALLOW_COPY_AND_ASSIGN(FakeMediaSource);
173 }; 175 };
174 176
175 } // namespace cast 177 } // namespace cast
176 } // namespace media 178 } // namespace media
177 179
178 #endif // MEDIA_CAST_TEST_FAKE_MEDIA_SOURCE_H_ 180 #endif // MEDIA_CAST_TEST_FAKE_MEDIA_SOURCE_H_
OLDNEW
« no previous file with comments | « media/base/media_file_checker.cc ('k') | media/cast/test/fake_media_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698