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

Side by Side Diff: media/webm/webm_cluster_parser_unittest.cc

Issue 17408005: Refactored DecoderBuffer to use unix_hacker_style naming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@localrefactor
Patch Set: Created 7 years, 5 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
« no previous file with comments | « media/webm/webm_cluster_parser.cc ('k') | webkit/plugins/ppapi/content_decryptor_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "media/base/decrypt_config.h" 9 #include "media/base/decrypt_config.h"
10 #include "media/webm/cluster_builder.h" 10 #include "media/webm/cluster_builder.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 LOG(ERROR) << "Unexpected track number " << block_info[i].track_num; 110 LOG(ERROR) << "Unexpected track number " << block_info[i].track_num;
111 return false; 111 return false;
112 } 112 }
113 113
114 if (*offset >= buffers->size()) 114 if (*offset >= buffers->size())
115 return false; 115 return false;
116 116
117 scoped_refptr<StreamParserBuffer> buffer = (*buffers)[(*offset)++]; 117 scoped_refptr<StreamParserBuffer> buffer = (*buffers)[(*offset)++];
118 118
119 119
120 EXPECT_EQ(buffer->GetTimestamp().InMilliseconds(), block_info[i].timestamp); 120 EXPECT_EQ(buffer->timestamp().InMilliseconds(), block_info[i].timestamp);
121 121
122 if (!block_info[i].use_simple_block) 122 if (!block_info[i].use_simple_block)
123 EXPECT_NE(buffer->GetDuration(), kNoTimestamp()); 123 EXPECT_NE(buffer->duration(), kNoTimestamp());
124 124
125 if (buffer->GetDuration() != kNoTimestamp()) 125 if (buffer->duration() != kNoTimestamp())
126 EXPECT_EQ(buffer->GetDuration().InMilliseconds(), block_info[i].duration); 126 EXPECT_EQ(buffer->duration().InMilliseconds(), block_info[i].duration);
127 } 127 }
128 128
129 return true; 129 return true;
130 } 130 }
131 131
132 static bool VerifyBuffers(const scoped_ptr<WebMClusterParser>& parser, 132 static bool VerifyBuffers(const scoped_ptr<WebMClusterParser>& parser,
133 const BlockInfo* block_info, 133 const BlockInfo* block_info,
134 int block_count) { 134 int block_count) {
135 typedef WebMClusterParser::TextTrackIterator TextTrackIterator; 135 typedef WebMClusterParser::TextTrackIterator TextTrackIterator;
136 TextTrackIterator text_it = parser->CreateTextTrackIterator(); 136 TextTrackIterator text_it = parser->CreateTextTrackIterator();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 while (block_info_ptr != block_info_end) { 168 while (block_info_ptr != block_info_end) {
169 const BlockInfo& block_info = *block_info_ptr++; 169 const BlockInfo& block_info = *block_info_ptr++;
170 170
171 if (block_info.track_num != text_track_num) 171 if (block_info.track_num != text_track_num)
172 continue; 172 continue;
173 173
174 EXPECT_FALSE(block_info.use_simple_block); 174 EXPECT_FALSE(block_info.use_simple_block);
175 EXPECT_FALSE(buffer_iter == buffer_end); 175 EXPECT_FALSE(buffer_iter == buffer_end);
176 176
177 const scoped_refptr<StreamParserBuffer> buffer = *buffer_iter++; 177 const scoped_refptr<StreamParserBuffer> buffer = *buffer_iter++;
178 EXPECT_EQ(buffer->GetTimestamp().InMilliseconds(), block_info.timestamp); 178 EXPECT_EQ(buffer->timestamp().InMilliseconds(), block_info.timestamp);
179 EXPECT_EQ(buffer->GetDuration().InMilliseconds(), block_info.duration); 179 EXPECT_EQ(buffer->duration().InMilliseconds(), block_info.duration);
180 } 180 }
181 181
182 EXPECT_TRUE(buffer_iter == buffer_end); 182 EXPECT_TRUE(buffer_iter == buffer_end);
183 return true; 183 return true;
184 } 184 }
185 185
186 static bool VerifyEncryptedBuffer( 186 static bool VerifyEncryptedBuffer(
187 scoped_refptr<StreamParserBuffer> buffer) { 187 scoped_refptr<StreamParserBuffer> buffer) {
188 EXPECT_TRUE(buffer->GetDecryptConfig()); 188 EXPECT_TRUE(buffer->decrypt_config());
189 EXPECT_EQ(static_cast<unsigned long>(DecryptConfig::kDecryptionKeySize), 189 EXPECT_EQ(static_cast<unsigned long>(DecryptConfig::kDecryptionKeySize),
190 buffer->GetDecryptConfig()->iv().length()); 190 buffer->decrypt_config()->iv().length());
191 const uint8* data = buffer->GetData(); 191 const uint8* data = buffer->data();
192 return data[0] & kWebMFlagEncryptedFrame; 192 return data[0] & kWebMFlagEncryptedFrame;
193 } 193 }
194 194
195 static void AppendToEnd(const WebMClusterParser::BufferQueue& src, 195 static void AppendToEnd(const WebMClusterParser::BufferQueue& src,
196 WebMClusterParser::BufferQueue* dest) { 196 WebMClusterParser::BufferQueue* dest) {
197 for (WebMClusterParser::BufferQueue::const_iterator itr = src.begin(); 197 for (WebMClusterParser::BufferQueue::const_iterator itr = src.begin();
198 itr != src.end(); ++itr) { 198 itr != src.end(); ++itr) {
199 dest->push_back(*itr); 199 dest->push_back(*itr);
200 } 200 }
201 } 201 }
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 WebMTracksParser::TextTracks(), 524 WebMTracksParser::TextTracks(),
525 std::set<int64>(), 525 std::set<int64>(),
526 std::string(), 526 std::string(),
527 "video_key_id", 527 "video_key_id",
528 LogCB())); 528 LogCB()));
529 int result = parser_->Parse(cluster->data(), cluster->size()); 529 int result = parser_->Parse(cluster->data(), cluster->size());
530 EXPECT_EQ(-1, result); 530 EXPECT_EQ(-1, result);
531 } 531 }
532 532
533 } // namespace media 533 } // namespace media
OLDNEW
« no previous file with comments | « media/webm/webm_cluster_parser.cc ('k') | webkit/plugins/ppapi/content_decryptor_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698