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 #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> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" |
15 #include "media/base/media_log.h" | 15 #include "media/base/media_log.h" |
16 #include "media/base/stream_parser.h" | 16 #include "media/base/stream_parser.h" |
17 #include "media/base/stream_parser_buffer.h" | 17 #include "media/base/stream_parser_buffer.h" |
18 #include "media/formats/webm/webm_parser.h" | 18 #include "media/formats/webm/webm_parser.h" |
19 #include "media/formats/webm/webm_tracks_parser.h" | 19 #include "media/formats/webm/webm_tracks_parser.h" |
20 | 20 |
21 namespace media { | 21 namespace media { |
22 | 22 |
23 class MEDIA_EXPORT WebMClusterParser : public WebMParserClient { | 23 class MEDIA_EXPORT WebMClusterParser : public WebMParserClient { |
24 public: | 24 public: |
25 typedef StreamParser::TrackId TrackId; | 25 typedef StreamParser::TrackId TrackId; |
26 | 26 |
| 27 // Arbitrarily-chosen numbers to estimate the duration of a buffer if none is |
| 28 // set and there is not enough information to get a better estimate. |
| 29 // TODO(wolenetz/acolwell): Parse audio codebook to determine missing audio |
| 30 // frame durations. See http://crbug.com/351166. |
| 31 enum { |
| 32 kDefaultAudioBufferDurationInMs = 23, // Common 1k samples @44.1kHz |
| 33 kDefaultVideoBufferDurationInMs = 42 // Low 24fps to reduce stalls |
| 34 }; |
| 35 |
27 private: | 36 private: |
28 // Helper class that manages per-track state. | 37 // Helper class that manages per-track state. |
29 class Track { | 38 class Track { |
30 public: | 39 public: |
31 Track(int track_num, bool is_video, base::TimeDelta default_duration); | 40 Track(int track_num, bool is_video, base::TimeDelta default_duration); |
32 ~Track(); | 41 ~Track(); |
33 | 42 |
34 int track_num() const { return track_num_; } | 43 int track_num() const { return track_num_; } |
35 const std::deque<scoped_refptr<StreamParserBuffer> >& buffers() const { | 44 const std::deque<scoped_refptr<StreamParserBuffer> >& buffers() const { |
36 return buffers_; | 45 return buffers_; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 TextBufferQueueMap text_buffers_map_; | 202 TextBufferQueueMap text_buffers_map_; |
194 | 203 |
195 LogCB log_cb_; | 204 LogCB log_cb_; |
196 | 205 |
197 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMClusterParser); | 206 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMClusterParser); |
198 }; | 207 }; |
199 | 208 |
200 } // namespace media | 209 } // namespace media |
201 | 210 |
202 #endif // MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_ | 211 #endif // MEDIA_FORMATS_WEBM_WEBM_CLUSTER_PARSER_H_ |
OLD | NEW |