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 #include "media/formats/webm/webm_cluster_parser.h" | 5 #include "media/formats/webm/webm_cluster_parser.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
11 #include "media/base/buffers.h" | 11 #include "media/base/buffers.h" |
12 #include "media/base/decrypt_config.h" | 12 #include "media/base/decrypt_config.h" |
13 #include "media/filters/webvtt_util.h" | 13 #include "media/filters/webvtt_util.h" |
14 #include "media/formats/webm/webm_constants.h" | 14 #include "media/formats/webm/webm_constants.h" |
15 #include "media/formats/webm/webm_crypto_helpers.h" | 15 #include "media/formats/webm/webm_crypto_helpers.h" |
16 #include "media/formats/webm/webm_webvtt_parser.h" | 16 #include "media/formats/webm/webm_webvtt_parser.h" |
17 | 17 |
18 // Arbitrarily-chosen numbers to estimate the duration of a buffer if none is | |
19 // set and there is not enough information to get a better estimate. | |
20 // TODO(wolenetz/acolwell): Parse audio codebook to determine missing audio | |
21 // frame durations. See http://crbug.com/351166. | |
22 static int kDefaultAudioBufferDurationInMs = 23; // Common 1k samples @44.1kHz | |
23 static int kDefaultVideoBufferDurationInMs = 42; // Low 24fps to reduce stalls | |
24 | |
25 namespace media { | 18 namespace media { |
26 | 19 |
27 WebMClusterParser::WebMClusterParser( | 20 WebMClusterParser::WebMClusterParser( |
28 int64 timecode_scale, | 21 int64 timecode_scale, |
29 int audio_track_num, | 22 int audio_track_num, |
30 base::TimeDelta audio_default_duration, | 23 base::TimeDelta audio_default_duration, |
31 int video_track_num, | 24 int video_track_num, |
32 base::TimeDelta video_default_duration, | 25 base::TimeDelta video_default_duration, |
33 const WebMTracksParser::TextTracks& text_tracks, | 26 const WebMTracksParser::TextTracks& text_tracks, |
34 const std::set<int64>& ignored_tracks, | 27 const std::set<int64>& ignored_tracks, |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 WebMClusterParser::FindTextTrack(int track_num) { | 574 WebMClusterParser::FindTextTrack(int track_num) { |
582 const TextTrackMap::iterator it = text_track_map_.find(track_num); | 575 const TextTrackMap::iterator it = text_track_map_.find(track_num); |
583 | 576 |
584 if (it == text_track_map_.end()) | 577 if (it == text_track_map_.end()) |
585 return NULL; | 578 return NULL; |
586 | 579 |
587 return &it->second; | 580 return &it->second; |
588 } | 581 } |
589 | 582 |
590 } // namespace media | 583 } // namespace media |
OLD | NEW |