OLD | NEW |
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 scoped_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 scoped_ptr<InMemoryUrlProtocol> protocol_; | 140 std::unique_ptr<InMemoryUrlProtocol> protocol_; |
141 scoped_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 AudioParameters source_audio_params_; | 145 AudioParameters source_audio_params_; |
146 double playback_rate_; | 146 double playback_rate_; |
147 | 147 |
148 int video_stream_index_; | 148 int video_stream_index_; |
149 int video_frame_rate_numerator_; | 149 int video_frame_rate_numerator_; |
150 int video_frame_rate_denominator_; | 150 int video_frame_rate_denominator_; |
151 | 151 |
152 // These are used for audio resampling. | 152 // These are used for audio resampling. |
153 scoped_ptr<media::AudioConverter> audio_converter_; | 153 std::unique_ptr<media::AudioConverter> audio_converter_; |
154 scoped_ptr<media::AudioFifo> audio_fifo_; | 154 std::unique_ptr<media::AudioFifo> audio_fifo_; |
155 scoped_ptr<media::AudioBus> audio_fifo_input_bus_; | 155 std::unique_ptr<media::AudioBus> audio_fifo_input_bus_; |
156 media::AudioRendererAlgorithm audio_algo_; | 156 media::AudioRendererAlgorithm audio_algo_; |
157 | 157 |
158 // Track the timestamp of audio sent to the receiver. | 158 // Track the timestamp of audio sent to the receiver. |
159 scoped_ptr<media::AudioTimestampHelper> audio_sent_ts_; | 159 std::unique_ptr<media::AudioTimestampHelper> audio_sent_ts_; |
160 | 160 |
161 std::queue<scoped_refptr<VideoFrame> > video_frame_queue_; | 161 std::queue<scoped_refptr<VideoFrame> > video_frame_queue_; |
162 std::queue<scoped_refptr<VideoFrame> > inserted_video_frame_queue_; | 162 std::queue<scoped_refptr<VideoFrame> > inserted_video_frame_queue_; |
163 int64_t video_first_pts_; | 163 int64_t video_first_pts_; |
164 bool video_first_pts_set_; | 164 bool video_first_pts_set_; |
165 base::TimeDelta last_video_frame_timestamp_; | 165 base::TimeDelta last_video_frame_timestamp_; |
166 | 166 |
167 std::queue<AudioBus*> audio_bus_queue_; | 167 std::queue<AudioBus*> audio_bus_queue_; |
168 | 168 |
169 // NOTE: Weak pointers must be invalidated before all other member variables. | 169 // NOTE: Weak pointers must be invalidated before all other member variables. |
170 base::WeakPtrFactory<FakeMediaSource> weak_factory_; | 170 base::WeakPtrFactory<FakeMediaSource> weak_factory_; |
171 | 171 |
172 DISALLOW_COPY_AND_ASSIGN(FakeMediaSource); | 172 DISALLOW_COPY_AND_ASSIGN(FakeMediaSource); |
173 }; | 173 }; |
174 | 174 |
175 } // namespace cast | 175 } // namespace cast |
176 } // namespace media | 176 } // namespace media |
177 | 177 |
178 #endif // MEDIA_CAST_TEST_FAKE_MEDIA_SOURCE_H_ | 178 #endif // MEDIA_CAST_TEST_FAKE_MEDIA_SOURCE_H_ |
OLD | NEW |