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

Side by Side Diff: media/filters/ffmpeg_demuxer.h

Issue 1494113002: Revert "Fix race on demuxer memory usage. Reuse previous calculation." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/demuxer.h ('k') | media/filters/ffmpeg_demuxer.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 // Implements the Demuxer interface using FFmpeg's libavformat. At this time 5 // Implements the Demuxer interface using FFmpeg's libavformat. At this time
6 // will support demuxing any audio/video format thrown at it. The streams 6 // will support demuxing any audio/video format thrown at it. The streams
7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer 7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer
8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs 8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs
9 // can be used to create and initialize the corresponding FFmpeg decoder. 9 // can be used to create and initialize the corresponding FFmpeg decoder.
10 // 10 //
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 void OnSeekFrameDone(const PipelineStatusCB& cb, int result); 226 void OnSeekFrameDone(const PipelineStatusCB& cb, int result);
227 227
228 // FFmpeg callbacks during reading + helper method to initiate reads. 228 // FFmpeg callbacks during reading + helper method to initiate reads.
229 void ReadFrameIfNeeded(); 229 void ReadFrameIfNeeded();
230 void OnReadFrameDone(ScopedAVPacket packet, int result); 230 void OnReadFrameDone(ScopedAVPacket packet, int result);
231 231
232 // Returns true iff any stream has additional capacity. Note that streams can 232 // Returns true iff any stream has additional capacity. Note that streams can
233 // go over capacity depending on how the file is muxed. 233 // go over capacity depending on how the file is muxed.
234 bool StreamsHaveAvailableCapacity(); 234 bool StreamsHaveAvailableCapacity();
235 235
236 // Updates |stream_memory_usage_| to the memory usage in bytes of all 236 // Returns true if the maximum allowed memory usage has been reached.
237 // FFmpegDemuxerStreams. Returns the current memory usage. 237 bool IsMaxMemoryUsageReached() const;
238 int64_t UpdateMemoryUsage();
239 238
240 // Signal all FFmpegDemuxerStreams that the stream has ended. 239 // Signal all FFmpegDemuxerStreams that the stream has ended.
241 void StreamHasEnded(); 240 void StreamHasEnded();
242 241
243 // Called by |url_protocol_| whenever |data_source_| returns a read error. 242 // Called by |url_protocol_| whenever |data_source_| returns a read error.
244 void OnDataSourceError(); 243 void OnDataSourceError();
245 244
246 // Returns the stream from |streams_| that matches |type| as an 245 // Returns the stream from |streams_| that matches |type| as an
247 // FFmpegDemuxerStream. 246 // FFmpegDemuxerStream.
248 FFmpegDemuxerStream* GetFFmpegStream(DemuxerStream::Type type) const; 247 FFmpegDemuxerStream* GetFFmpegStream(DemuxerStream::Type type) const;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // Set if we know duration of the audio stream. Used when processing end of 316 // Set if we know duration of the audio stream. Used when processing end of
318 // stream -- at this moment we definitely know duration. 317 // stream -- at this moment we definitely know duration.
319 bool duration_known_; 318 bool duration_known_;
320 319
321 // FFmpegURLProtocol implementation and corresponding glue bits. 320 // FFmpegURLProtocol implementation and corresponding glue bits.
322 scoped_ptr<BlockingUrlProtocol> url_protocol_; 321 scoped_ptr<BlockingUrlProtocol> url_protocol_;
323 scoped_ptr<FFmpegGlue> glue_; 322 scoped_ptr<FFmpegGlue> glue_;
324 323
325 const EncryptedMediaInitDataCB encrypted_media_init_data_cb_; 324 const EncryptedMediaInitDataCB encrypted_media_init_data_cb_;
326 325
327 // Last stream size as calculated by UpdateMemoryUsage().
328 mutable base::Lock stream_memory_usage_lock_;
329 int64_t stream_memory_usage_;
330
331 // NOTE: Weak pointers must be invalidated before all other member variables. 326 // NOTE: Weak pointers must be invalidated before all other member variables.
332 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; 327 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_;
333 328
334 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 329 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
335 }; 330 };
336 331
337 } // namespace media 332 } // namespace media
338 333
339 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 334 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW
« no previous file with comments | « media/base/demuxer.h ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698