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

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

Issue 238273002: Adds WebMClusterParserTest coverage for duration default/estimation/fallback logic (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix lint errors Created 6 years, 8 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 | Annotate | Revision Log
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 #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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 WebMClusterParser::FindTextTrack(int track_num) { 564 WebMClusterParser::FindTextTrack(int track_num) {
572 const TextTrackMap::iterator it = text_track_map_.find(track_num); 565 const TextTrackMap::iterator it = text_track_map_.find(track_num);
573 566
574 if (it == text_track_map_.end()) 567 if (it == text_track_map_.end())
575 return NULL; 568 return NULL;
576 569
577 return &it->second; 570 return &it->second;
578 } 571 }
579 572
580 } // namespace media 573 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698