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

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

Issue 2855373002: Use ffmpeg packet.pos for restarting reading after reenabling video
Patch Set: fixed audio rewinding Created 3 years, 7 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/filters/ffmpeg_demuxer.cc » ('j') | media/filters/ffmpeg_demuxer.cc » ('J')
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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 264
265 // FFmpeg callbacks during initialization. 265 // FFmpeg callbacks during initialization.
266 void OnOpenContextDone(const PipelineStatusCB& status_cb, bool result); 266 void OnOpenContextDone(const PipelineStatusCB& status_cb, bool result);
267 void OnFindStreamInfoDone(const PipelineStatusCB& status_cb, int result); 267 void OnFindStreamInfoDone(const PipelineStatusCB& status_cb, int result);
268 268
269 void LogMetadata(AVFormatContext* avctx, base::TimeDelta max_duration); 269 void LogMetadata(AVFormatContext* avctx, base::TimeDelta max_duration);
270 270
271 // FFmpeg callbacks during seeking. 271 // FFmpeg callbacks during seeking.
272 void OnSeekFrameDone(int result); 272 void OnSeekFrameDone(int result);
273 273
274 // Called when FFmpeg completes seek initiated in OnSelectedVideoTrackChanged
275 // in order to restart the |stream|.
276 void OnSeekDoneForRestartingStream(FFmpegDemuxerStream* stream, int result);
277
274 // FFmpeg callbacks during reading + helper method to initiate reads. 278 // FFmpeg callbacks during reading + helper method to initiate reads.
275 void ReadFrameIfNeeded(); 279 void ReadFrameIfNeeded();
276 void OnReadFrameDone(ScopedAVPacket packet, int result); 280 void OnReadFrameDone(ScopedAVPacket packet, int result);
277 281
278 // Returns true iff any stream has additional capacity. Note that streams can 282 // Returns true iff any stream has additional capacity. Note that streams can
279 // go over capacity depending on how the file is muxed. 283 // go over capacity depending on how the file is muxed.
280 bool StreamsHaveAvailableCapacity(); 284 bool StreamsHaveAvailableCapacity();
281 285
282 // Returns true if the maximum allowed memory usage has been reached. 286 // Returns true if the maximum allowed memory usage has been reached.
283 bool IsMaxMemoryUsageReached() const; 287 bool IsMaxMemoryUsageReached() const;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // FFmpegURLProtocol implementation and corresponding glue bits. 376 // FFmpegURLProtocol implementation and corresponding glue bits.
373 std::unique_ptr<BlockingUrlProtocol> url_protocol_; 377 std::unique_ptr<BlockingUrlProtocol> url_protocol_;
374 std::unique_ptr<FFmpegGlue> glue_; 378 std::unique_ptr<FFmpegGlue> glue_;
375 379
376 const EncryptedMediaInitDataCB encrypted_media_init_data_cb_; 380 const EncryptedMediaInitDataCB encrypted_media_init_data_cb_;
377 381
378 const MediaTracksUpdatedCB media_tracks_updated_cb_; 382 const MediaTracksUpdatedCB media_tracks_updated_cb_;
379 383
380 std::map<MediaTrack::Id, FFmpegDemuxerStream*> track_id_to_demux_stream_map_; 384 std::map<MediaTrack::Id, FFmpegDemuxerStream*> track_id_to_demux_stream_map_;
381 385
386 int64_t last_packet_pos_;
387 FFmpegDemuxerStream* restarting_stream_;
388
382 // NOTE: Weak pointers must be invalidated before all other member variables. 389 // NOTE: Weak pointers must be invalidated before all other member variables.
383 base::WeakPtr<FFmpegDemuxer> weak_this_; 390 base::WeakPtr<FFmpegDemuxer> weak_this_;
384 base::WeakPtrFactory<FFmpegDemuxer> cancel_pending_seek_factory_; 391 base::WeakPtrFactory<FFmpegDemuxer> cancel_pending_seek_factory_;
385 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; 392 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_;
386 393
387 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 394 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
388 }; 395 };
389 396
390 } // namespace media 397 } // namespace media
391 398
392 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 399 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/ffmpeg_demuxer.cc » ('j') | media/filters/ffmpeg_demuxer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698