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

Side by Side Diff: media/formats/mp2t/mp2t_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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 segment_count_ = 0; 77 segment_count_ = 0;
78 config_count_ = 0; 78 config_count_ = 0;
79 audio_frame_count_ = 0; 79 audio_frame_count_ = 0;
80 video_frame_count_ = 0; 80 video_frame_count_ = 0;
81 audio_min_dts_ = kNoDecodeTimestamp(); 81 audio_min_dts_ = kNoDecodeTimestamp();
82 audio_max_dts_ = kNoDecodeTimestamp(); 82 audio_max_dts_ = kNoDecodeTimestamp();
83 video_min_dts_ = kNoDecodeTimestamp(); 83 video_min_dts_ = kNoDecodeTimestamp();
84 video_max_dts_ = kNoDecodeTimestamp(); 84 video_max_dts_ = kNoDecodeTimestamp();
85 } 85 }
86 86
87 bool AppendData(const uint8* data, size_t length) { 87 bool AppendData(const uint8_t* data, size_t length) {
88 return parser_->Parse(data, length); 88 return parser_->Parse(data, length);
89 } 89 }
90 90
91 bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size) { 91 bool AppendDataInPieces(const uint8_t* data,
92 const uint8* start = data; 92 size_t length,
93 const uint8* end = data + length; 93 size_t piece_size) {
94 const uint8_t* start = data;
95 const uint8_t* end = data + length;
94 while (start < end) { 96 while (start < end) {
95 size_t append_size = std::min(piece_size, 97 size_t append_size = std::min(piece_size,
96 static_cast<size_t>(end - start)); 98 static_cast<size_t>(end - start));
97 if (!AppendData(start, append_size)) 99 if (!AppendData(start, append_size))
98 return false; 100 return false;
99 start += append_size; 101 start += append_size;
100 } 102 }
101 return true; 103 return true;
102 } 104 }
103 105
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 if (audio_min_dts_ == kNoDecodeTimestamp()) 166 if (audio_min_dts_ == kNoDecodeTimestamp())
165 audio_min_dts_ = first_dts; 167 audio_min_dts_ = first_dts;
166 audio_max_dts_ = last_dts; 168 audio_max_dts_ = last_dts;
167 } 169 }
168 170
169 audio_frame_count_ += audio_buffers.size(); 171 audio_frame_count_ += audio_buffers.size();
170 video_frame_count_ += video_buffers.size(); 172 video_frame_count_ += video_buffers.size();
171 return true; 173 return true;
172 } 174 }
173 175
174 void OnKeyNeeded(EmeInitDataType type, const std::vector<uint8>& init_data) { 176 void OnKeyNeeded(EmeInitDataType type,
177 const std::vector<uint8_t>& init_data) {
175 NOTREACHED() << "OnKeyNeeded not expected in the Mpeg2 TS parser"; 178 NOTREACHED() << "OnKeyNeeded not expected in the Mpeg2 TS parser";
176 } 179 }
177 180
178 void OnNewSegment() { 181 void OnNewSegment() {
179 DVLOG(1) << "OnNewSegment"; 182 DVLOG(1) << "OnNewSegment";
180 segment_count_++; 183 segment_count_++;
181 } 184 }
182 185
183 void OnEndOfSegment() { 186 void OnEndOfSegment() {
184 NOTREACHED() << "OnEndOfSegment not expected in the Mpeg2 TS parser"; 187 NOTREACHED() << "OnEndOfSegment not expected in the Mpeg2 TS parser";
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 parser_->Flush(); 287 parser_->Flush();
285 EXPECT_EQ(audio_frame_count_, 40); 288 EXPECT_EQ(audio_frame_count_, 40);
286 EXPECT_EQ(video_frame_count_, 0); 289 EXPECT_EQ(video_frame_count_, 0);
287 // This stream has no mid-stream configuration change. 290 // This stream has no mid-stream configuration change.
288 EXPECT_EQ(config_count_, 1); 291 EXPECT_EQ(config_count_, 1);
289 EXPECT_EQ(segment_count_, 1); 292 EXPECT_EQ(segment_count_, 1);
290 } 293 }
291 294
292 } // namespace mp2t 295 } // namespace mp2t
293 } // namespace media 296 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698