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

Side by Side Diff: media/formats/mp4/mp4_stream_parser_unittest.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 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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 protected: 57 protected:
58 scoped_refptr<StrictMock<MockMediaLog>> media_log_; 58 scoped_refptr<StrictMock<MockMediaLog>> media_log_;
59 scoped_ptr<MP4StreamParser> parser_; 59 scoped_ptr<MP4StreamParser> parser_;
60 bool configs_received_; 60 bool configs_received_;
61 AudioDecoderConfig audio_decoder_config_; 61 AudioDecoderConfig audio_decoder_config_;
62 VideoDecoderConfig video_decoder_config_; 62 VideoDecoderConfig video_decoder_config_;
63 DecodeTimestamp lower_bound_; 63 DecodeTimestamp lower_bound_;
64 64
65 bool AppendData(const uint8* data, size_t length) { 65 bool AppendData(const uint8_t* data, size_t length) {
66 return parser_->Parse(data, length); 66 return parser_->Parse(data, length);
67 } 67 }
68 68
69 bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size) { 69 bool AppendDataInPieces(const uint8_t* data,
70 const uint8* start = data; 70 size_t length,
71 const uint8* end = data + length; 71 size_t piece_size) {
72 const uint8_t* start = data;
73 const uint8_t* end = data + length;
72 while (start < end) { 74 while (start < end) {
73 size_t append_size = std::min(piece_size, 75 size_t append_size = std::min(piece_size,
74 static_cast<size_t>(end - start)); 76 static_cast<size_t>(end - start));
75 if (!AppendData(start, append_size)) 77 if (!AppendData(start, append_size))
76 return false; 78 return false;
77 start += append_size; 79 start += append_size;
78 } 80 }
79 return true; 81 return true;
80 } 82 }
81 83
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 135
134 if (lower_bound_ != kNoDecodeTimestamp() && 136 if (lower_bound_ != kNoDecodeTimestamp() &&
135 second_highest_timestamp < lower_bound_) { 137 second_highest_timestamp < lower_bound_) {
136 return false; 138 return false;
137 } 139 }
138 140
139 lower_bound_ = second_highest_timestamp; 141 lower_bound_ = second_highest_timestamp;
140 return true; 142 return true;
141 } 143 }
142 144
143 void KeyNeededF(EmeInitDataType type, const std::vector<uint8>& init_data) { 145 void KeyNeededF(EmeInitDataType type, const std::vector<uint8_t>& init_data) {
144 DVLOG(1) << "KeyNeededF: " << init_data.size(); 146 DVLOG(1) << "KeyNeededF: " << init_data.size();
145 EXPECT_EQ(EmeInitDataType::CENC, type); 147 EXPECT_EQ(EmeInitDataType::CENC, type);
146 EXPECT_FALSE(init_data.empty()); 148 EXPECT_FALSE(init_data.empty());
147 } 149 }
148 150
149 void NewSegmentF() { 151 void NewSegmentF() {
150 DVLOG(1) << "NewSegmentF"; 152 DVLOG(1) << "NewSegmentF";
151 lower_bound_ = kNoDecodeTimestamp(); 153 lower_bound_ = kNoDecodeTimestamp();
152 } 154 }
153 155
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 scoped_refptr<DecoderBuffer> buffer = 333 scoped_refptr<DecoderBuffer> buffer =
332 ReadTestDataFile("bear-640x360-non_square_pixel-with_pasp.mp4"); 334 ReadTestDataFile("bear-640x360-non_square_pixel-with_pasp.mp4");
333 335
334 EXPECT_MEDIA_LOG(VideoCodecLog("avc1.6401e")); 336 EXPECT_MEDIA_LOG(VideoCodecLog("avc1.6401e"));
335 EXPECT_TRUE(AppendDataInPieces(buffer->data(), buffer->data_size(), 512)); 337 EXPECT_TRUE(AppendDataInPieces(buffer->data(), buffer->data_size(), 512));
336 EXPECT_EQ(gfx::Size(639, 360), video_decoder_config_.natural_size()); 338 EXPECT_EQ(gfx::Size(639, 360), video_decoder_config_.natural_size());
337 } 339 }
338 340
339 } // namespace mp4 341 } // namespace mp4
340 } // namespace media 342 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698