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

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

Issue 1935873002: Implement disabling and enabling media tracks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track-control2
Patch Set: rebase Created 4 years, 5 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 | « media/filters/decrypting_demuxer_stream.cc ('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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 // DemuxerStream implementation. 104 // DemuxerStream implementation.
105 Type type() const override; 105 Type type() const override;
106 Liveness liveness() const override; 106 Liveness liveness() const override;
107 void Read(const ReadCB& read_cb) override; 107 void Read(const ReadCB& read_cb) override;
108 void EnableBitstreamConverter() override; 108 void EnableBitstreamConverter() override;
109 bool SupportsConfigChanges() override; 109 bool SupportsConfigChanges() override;
110 AudioDecoderConfig audio_decoder_config() override; 110 AudioDecoderConfig audio_decoder_config() override;
111 VideoDecoderConfig video_decoder_config() override; 111 VideoDecoderConfig video_decoder_config() override;
112 VideoRotation video_rotation() override; 112 VideoRotation video_rotation() override;
113 bool enabled() const override;
114 void set_enabled(bool enabled, base::TimeDelta timestamp) override;
115 void SetStreamRestartedCB(const StreamRestartedCB& cb) override;
113 116
114 void SetLiveness(Liveness liveness); 117 void SetLiveness(Liveness liveness);
115 118
116 // Returns the range of buffered data in this stream. 119 // Returns the range of buffered data in this stream.
117 Ranges<base::TimeDelta> GetBufferedRanges() const; 120 Ranges<base::TimeDelta> GetBufferedRanges() const;
118 121
119 // Returns elapsed time based on the already queued packets. 122 // Returns elapsed time based on the already queued packets.
120 // Used to determine stream duration when it's not known ahead of time. 123 // Used to determine stream duration when it's not known ahead of time.
121 base::TimeDelta GetElapsedTime() const; 124 base::TimeDelta GetElapsedTime() const;
122 125
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 std::unique_ptr<AudioDecoderConfig> audio_config_; 167 std::unique_ptr<AudioDecoderConfig> audio_config_;
165 std::unique_ptr<VideoDecoderConfig> video_config_; 168 std::unique_ptr<VideoDecoderConfig> video_config_;
166 Type type_; 169 Type type_;
167 Liveness liveness_; 170 Liveness liveness_;
168 base::TimeDelta duration_; 171 base::TimeDelta duration_;
169 bool end_of_stream_; 172 bool end_of_stream_;
170 base::TimeDelta last_packet_timestamp_; 173 base::TimeDelta last_packet_timestamp_;
171 base::TimeDelta last_packet_duration_; 174 base::TimeDelta last_packet_duration_;
172 Ranges<base::TimeDelta> buffered_ranges_; 175 Ranges<base::TimeDelta> buffered_ranges_;
173 VideoRotation video_rotation_; 176 VideoRotation video_rotation_;
177 bool is_enabled_;
178 bool waiting_for_keyframe_;
174 179
175 DecoderBufferQueue buffer_queue_; 180 DecoderBufferQueue buffer_queue_;
176 ReadCB read_cb_; 181 ReadCB read_cb_;
182 StreamRestartedCB stream_restarted_cb_;
177 183
178 #if defined(USE_PROPRIETARY_CODECS) 184 #if defined(USE_PROPRIETARY_CODECS)
179 std::unique_ptr<FFmpegBitstreamConverter> bitstream_converter_; 185 std::unique_ptr<FFmpegBitstreamConverter> bitstream_converter_;
180 #endif 186 #endif
181 187
182 std::string encryption_key_id_; 188 std::string encryption_key_id_;
183 bool fixup_negative_timestamps_; 189 bool fixup_negative_timestamps_;
184 190
185 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); 191 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream);
186 }; 192 };
(...skipping 24 matching lines...) Expand all
211 // Calls |encrypted_media_init_data_cb_| with the initialization data 217 // Calls |encrypted_media_init_data_cb_| with the initialization data
212 // encountered in the file. 218 // encountered in the file.
213 void OnEncryptedMediaInitData(EmeInitDataType init_data_type, 219 void OnEncryptedMediaInitData(EmeInitDataType init_data_type,
214 const std::string& encryption_key_id); 220 const std::string& encryption_key_id);
215 221
216 // Allow FFmpegDemuxerStream to notify us when there is updated information 222 // Allow FFmpegDemuxerStream to notify us when there is updated information
217 // about capacity and what buffered data is available. 223 // about capacity and what buffered data is available.
218 void NotifyCapacityAvailable(); 224 void NotifyCapacityAvailable();
219 void NotifyBufferingChanged(); 225 void NotifyBufferingChanged();
220 226
227 void OnEnabledAudioTracksChanged(const std::vector<MediaTrack::Id>& track_ids,
228 base::TimeDelta currTime) override;
229 // |track_ids| is either empty or contains a single video track id.
230 void OnSelectedVideoTrackChanged(const std::vector<MediaTrack::Id>& track_ids,
231 base::TimeDelta currTime) override;
232
221 // The lowest demuxed timestamp. If negative, DemuxerStreams must use this to 233 // The lowest demuxed timestamp. If negative, DemuxerStreams must use this to
222 // adjust packet timestamps such that external clients see a zero-based 234 // adjust packet timestamps such that external clients see a zero-based
223 // timeline. 235 // timeline.
224 base::TimeDelta start_time() const { return start_time_; } 236 base::TimeDelta start_time() const { return start_time_; }
225 237
226 private: 238 private:
227 // To allow tests access to privates. 239 // To allow tests access to privates.
228 friend class FFmpegDemuxerTest; 240 friend class FFmpegDemuxerTest;
229 241
230 // FFmpeg callbacks during initialization. 242 // FFmpeg callbacks during initialization.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 bool duration_known_; 339 bool duration_known_;
328 340
329 // FFmpegURLProtocol implementation and corresponding glue bits. 341 // FFmpegURLProtocol implementation and corresponding glue bits.
330 std::unique_ptr<BlockingUrlProtocol> url_protocol_; 342 std::unique_ptr<BlockingUrlProtocol> url_protocol_;
331 std::unique_ptr<FFmpegGlue> glue_; 343 std::unique_ptr<FFmpegGlue> glue_;
332 344
333 const EncryptedMediaInitDataCB encrypted_media_init_data_cb_; 345 const EncryptedMediaInitDataCB encrypted_media_init_data_cb_;
334 346
335 const MediaTracksUpdatedCB media_tracks_updated_cb_; 347 const MediaTracksUpdatedCB media_tracks_updated_cb_;
336 348
349 std::map<MediaTrack::Id, const DemuxerStream*> track_id_to_demux_stream_map_;
350
337 // NOTE: Weak pointers must be invalidated before all other member variables. 351 // NOTE: Weak pointers must be invalidated before all other member variables.
338 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; 352 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_;
339 353
340 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 354 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
341 }; 355 };
342 356
343 } // namespace media 357 } // namespace media
344 358
345 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 359 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW
« no previous file with comments | « media/filters/decrypting_demuxer_stream.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698