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

Side by Side Diff: media/formats/webm/webm_cluster_parser.h

Issue 1235793005: Deprecate LogCB in favor of using MediaLog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments and attempt to fix Android compilation Created 5 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/formats/webm/webm_audio_client.cc ('k') | media/formats/webm/webm_cluster_parser.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 #ifndef MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_ 5 #ifndef MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_
6 #define MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_ 6 #define MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // https://tools.ietf.org/html/rfc6716#page-14 44 // https://tools.ietf.org/html/rfc6716#page-14
45 static const uint16_t kOpusFrameDurationsMu[]; 45 static const uint16_t kOpusFrameDurationsMu[];
46 46
47 private: 47 private:
48 // Helper class that manages per-track state. 48 // Helper class that manages per-track state.
49 class Track { 49 class Track {
50 public: 50 public:
51 Track(int track_num, 51 Track(int track_num,
52 bool is_video, 52 bool is_video,
53 base::TimeDelta default_duration, 53 base::TimeDelta default_duration,
54 const LogCB& log_cb); 54 const scoped_refptr<MediaLog>& media_log);
55 ~Track(); 55 ~Track();
56 56
57 int track_num() const { return track_num_; } 57 int track_num() const { return track_num_; }
58 58
59 // If a buffer is currently held aside pending duration calculation, returns 59 // If a buffer is currently held aside pending duration calculation, returns
60 // its decode timestamp. Otherwise, returns kInfiniteDuration(). 60 // its decode timestamp. Otherwise, returns kInfiniteDuration().
61 DecodeTimestamp GetReadyUpperBound(); 61 DecodeTimestamp GetReadyUpperBound();
62 62
63 // Prepares |ready_buffers_| for retrieval. Prior to calling, 63 // Prepares |ready_buffers_| for retrieval. Prior to calling,
64 // |ready_buffers_| must be empty. Moves all |buffers_| with decode 64 // |ready_buffers_| must be empty. Moves all |buffers_| with decode
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // If kNoTimestamp(), then |estimated_next_frame_duration_| will be used. 136 // If kNoTimestamp(), then |estimated_next_frame_duration_| will be used.
137 base::TimeDelta default_duration_; 137 base::TimeDelta default_duration_;
138 138
139 // If kNoTimestamp(), then a default value will be used. This estimate is 139 // If kNoTimestamp(), then a default value will be used. This estimate is
140 // the maximum (for video), or minimum (for audio) duration seen so far for 140 // the maximum (for video), or minimum (for audio) duration seen so far for
141 // this track, and is used only if |default_duration_| is kNoTimestamp(). 141 // this track, and is used only if |default_duration_| is kNoTimestamp().
142 // TODO(chcunningham): Use maximum for audio too, adding checks to disable 142 // TODO(chcunningham): Use maximum for audio too, adding checks to disable
143 // splicing when these estimates are observed in SourceBufferStream. 143 // splicing when these estimates are observed in SourceBufferStream.
144 base::TimeDelta estimated_next_frame_duration_; 144 base::TimeDelta estimated_next_frame_duration_;
145 145
146 LogCB log_cb_; 146 scoped_refptr<MediaLog> media_log_;
147 }; 147 };
148 148
149 typedef std::map<int, Track> TextTrackMap; 149 typedef std::map<int, Track> TextTrackMap;
150 150
151 public: 151 public:
152 WebMClusterParser(int64 timecode_scale, 152 WebMClusterParser(int64 timecode_scale,
153 int audio_track_num, 153 int audio_track_num,
154 base::TimeDelta audio_default_duration, 154 base::TimeDelta audio_default_duration,
155 int video_track_num, 155 int video_track_num,
156 base::TimeDelta video_default_duration, 156 base::TimeDelta video_default_duration,
157 const WebMTracksParser::TextTracks& text_tracks, 157 const WebMTracksParser::TextTracks& text_tracks,
158 const std::set<int64>& ignored_tracks, 158 const std::set<int64>& ignored_tracks,
159 const std::string& audio_encryption_key_id, 159 const std::string& audio_encryption_key_id,
160 const std::string& video_encryption_key_id, 160 const std::string& video_encryption_key_id,
161 const AudioCodec audio_codec_, 161 const AudioCodec audio_codec,
162 const LogCB& log_cb); 162 const scoped_refptr<MediaLog>& media_log);
163 ~WebMClusterParser() override; 163 ~WebMClusterParser() override;
164 164
165 // Resets the parser state so it can accept a new cluster. 165 // Resets the parser state so it can accept a new cluster.
166 void Reset(); 166 void Reset();
167 167
168 // Parses a WebM cluster element in |buf|. 168 // Parses a WebM cluster element in |buf|.
169 // 169 //
170 // Returns -1 if the parse fails. 170 // Returns -1 if the parse fails.
171 // Returns 0 if more data is needed. 171 // Returns 0 if more data is needed.
172 // Returns the number of bytes parsed on success. 172 // Returns the number of bytes parsed on success.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 TextBufferQueueMap text_buffers_map_; 308 TextBufferQueueMap text_buffers_map_;
309 309
310 // Limits the range of buffers returned by Get{Audio,Video,Text}Buffers() to 310 // Limits the range of buffers returned by Get{Audio,Video,Text}Buffers() to
311 // this exclusive upper bound. Set to kNoDecodeTimestamp(), meaning not yet 311 // this exclusive upper bound. Set to kNoDecodeTimestamp(), meaning not yet
312 // calculated, by Reset() and Parse(). If kNoDecodeTimestamp(), then 312 // calculated, by Reset() and Parse(). If kNoDecodeTimestamp(), then
313 // Get{Audio,Video,Text}Buffers() will calculate it to be the minimum (decode) 313 // Get{Audio,Video,Text}Buffers() will calculate it to be the minimum (decode)
314 // timestamp across all tracks' |last_buffer_missing_duration_|, or 314 // timestamp across all tracks' |last_buffer_missing_duration_|, or
315 // kInfiniteDuration() if no buffers are currently missing duration. 315 // kInfiniteDuration() if no buffers are currently missing duration.
316 DecodeTimestamp ready_buffer_upper_bound_; 316 DecodeTimestamp ready_buffer_upper_bound_;
317 317
318 LogCB log_cb_; 318 scoped_refptr<MediaLog> media_log_;
319 319
320 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMClusterParser); 320 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMClusterParser);
321 }; 321 };
322 322
323 } // namespace media 323 } // namespace media
324 324
325 #endif // MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_ 325 #endif // MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_
OLDNEW
« no previous file with comments | « media/formats/webm/webm_audio_client.cc ('k') | media/formats/webm/webm_cluster_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698