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

Side by Side Diff: media/test/pipeline_integration_test.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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
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 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 Mp3FastSeekParams config = GetParam(); 1245 Mp3FastSeekParams config = GetParam();
1246 ASSERT_EQ(PIPELINE_OK, Start(config.filename, kHashed)); 1246 ASSERT_EQ(PIPELINE_OK, Start(config.filename, kHashed));
1247 1247
1248 // The XING TOC is inaccurate. We don't use it for CBR, we tolerate it for VBR 1248 // The XING TOC is inaccurate. We don't use it for CBR, we tolerate it for VBR
1249 // (best option for fast seeking; see Mp3SeekFFmpegDemuxerTest). The chosen 1249 // (best option for fast seeking; see Mp3SeekFFmpegDemuxerTest). The chosen
1250 // seek time exposes inaccuracy in TOC such that the hash will change if seek 1250 // seek time exposes inaccuracy in TOC such that the hash will change if seek
1251 // logic is regressed. See https://crbug.com/545914. 1251 // logic is regressed. See https://crbug.com/545914.
1252 // 1252 //
1253 // Quick TOC design (not pretty!): 1253 // Quick TOC design (not pretty!):
1254 // - All MP3 TOCs are 100 bytes 1254 // - All MP3 TOCs are 100 bytes
1255 // - Each byte is read as a uint8; value between 0 - 255. 1255 // - Each byte is read as a uint8_t; value between 0 - 255.
1256 // - The index into this array is the numerator in the ratio: index / 100. 1256 // - The index into this array is the numerator in the ratio: index / 100.
1257 // This fraction represents a playback time as a percentage of duration. 1257 // This fraction represents a playback time as a percentage of duration.
1258 // - The value at the given index is the numerator in the ratio: value / 256. 1258 // - The value at the given index is the numerator in the ratio: value / 256.
1259 // This fraction represents a byte offset as a percentage of the file size. 1259 // This fraction represents a byte offset as a percentage of the file size.
1260 // 1260 //
1261 // For CBR files, each frame is the same size, so the offset for time of 1261 // For CBR files, each frame is the same size, so the offset for time of
1262 // (0.98 * duration) should be around (0.98 * file size). This is 250.88 / 256 1262 // (0.98 * duration) should be around (0.98 * file size). This is 250.88 / 256
1263 // but the numerator will be truncated in the TOC as 250, losing precision. 1263 // but the numerator will be truncated in the TOC as 250, losing precision.
1264 base::TimeDelta seek_time(0.98 * pipeline_->GetMediaDuration()); 1264 base::TimeDelta seek_time(0.98 * pipeline_->GetMediaDuration());
1265 1265
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 1931
1932 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 1932 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
1933 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 1933 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
1934 Play(); 1934 Play();
1935 ASSERT_TRUE(WaitUntilOnEnded()); 1935 ASSERT_TRUE(WaitUntilOnEnded());
1936 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 1936 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
1937 demuxer_->GetStartTime()); 1937 demuxer_->GetStartTime());
1938 } 1938 }
1939 1939
1940 } // namespace media 1940 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698