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

Side by Side Diff: webrtc/media/base/testutils.cc

Issue 1838353004: cricket::VideoFrame cleanup. New width() and height(). Deleted GetChroma* methods. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: TODO comments. Formatting tweak. Created 4 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
« no previous file with comments | « webrtc/media/base/testutils.h ('k') | webrtc/media/base/videobroadcaster.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 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 int w, 299 int w,
300 int h) { 300 int h) {
301 rtc::FileStream fs; 301 rtc::FileStream fs;
302 char filename[256]; 302 char filename[256];
303 rtc::sprintfn(filename, sizeof(filename), "%s.%dx%d_ARGB.raw", 303 rtc::sprintfn(filename, sizeof(filename), "%s.%dx%d_ARGB.raw",
304 prefix.c_str(), w, h); 304 prefix.c_str(), w, h);
305 fs.Open(filename, "wb", NULL); 305 fs.Open(filename, "wb", NULL);
306 fs.Write(img, ARGB_SIZE(w, h), NULL, NULL); 306 fs.Write(img, ARGB_SIZE(w, h), NULL, NULL);
307 } 307 }
308 308
309 bool VideoFrameEqual(const VideoFrame* frame0, const VideoFrame* frame1) {
310 const uint8_t* y0 = frame0->GetYPlane();
311 const uint8_t* u0 = frame0->GetUPlane();
312 const uint8_t* v0 = frame0->GetVPlane();
313 const uint8_t* y1 = frame1->GetYPlane();
314 const uint8_t* u1 = frame1->GetUPlane();
315 const uint8_t* v1 = frame1->GetVPlane();
316
317 for (size_t i = 0; i < frame0->GetHeight(); ++i) {
318 if (0 != memcmp(y0, y1, frame0->GetWidth())) {
319 return false;
320 }
321 y0 += frame0->GetYPitch();
322 y1 += frame1->GetYPitch();
323 }
324
325 for (size_t i = 0; i < frame0->GetChromaHeight(); ++i) {
326 if (0 != memcmp(u0, u1, frame0->GetChromaWidth())) {
327 return false;
328 }
329 if (0 != memcmp(v0, v1, frame0->GetChromaWidth())) {
330 return false;
331 }
332 u0 += frame0->GetUPitch();
333 v0 += frame0->GetVPitch();
334 u1 += frame1->GetUPitch();
335 v1 += frame1->GetVPitch();
336 }
337
338 return true;
339 }
340
341 cricket::StreamParams CreateSimStreamParams( 309 cricket::StreamParams CreateSimStreamParams(
342 const std::string& cname, 310 const std::string& cname,
343 const std::vector<uint32_t>& ssrcs) { 311 const std::vector<uint32_t>& ssrcs) {
344 cricket::StreamParams sp; 312 cricket::StreamParams sp;
345 cricket::SsrcGroup sg(cricket::kSimSsrcGroupSemantics, ssrcs); 313 cricket::SsrcGroup sg(cricket::kSimSsrcGroupSemantics, ssrcs);
346 sp.ssrcs = ssrcs; 314 sp.ssrcs = ssrcs;
347 sp.ssrc_groups.push_back(sg); 315 sp.ssrc_groups.push_back(sg);
348 sp.cname = cname; 316 sp.cname = cname;
349 return sp; 317 return sp;
350 } 318 }
351 319
352 // There should be an rtx_ssrc per ssrc. 320 // There should be an rtx_ssrc per ssrc.
353 cricket::StreamParams CreateSimWithRtxStreamParams( 321 cricket::StreamParams CreateSimWithRtxStreamParams(
354 const std::string& cname, 322 const std::string& cname,
355 const std::vector<uint32_t>& ssrcs, 323 const std::vector<uint32_t>& ssrcs,
356 const std::vector<uint32_t>& rtx_ssrcs) { 324 const std::vector<uint32_t>& rtx_ssrcs) {
357 cricket::StreamParams sp = CreateSimStreamParams(cname, ssrcs); 325 cricket::StreamParams sp = CreateSimStreamParams(cname, ssrcs);
358 for (size_t i = 0; i < ssrcs.size(); ++i) { 326 for (size_t i = 0; i < ssrcs.size(); ++i) {
359 sp.ssrcs.push_back(rtx_ssrcs[i]); 327 sp.ssrcs.push_back(rtx_ssrcs[i]);
360 std::vector<uint32_t> fid_ssrcs; 328 std::vector<uint32_t> fid_ssrcs;
361 fid_ssrcs.push_back(ssrcs[i]); 329 fid_ssrcs.push_back(ssrcs[i]);
362 fid_ssrcs.push_back(rtx_ssrcs[i]); 330 fid_ssrcs.push_back(rtx_ssrcs[i]);
363 cricket::SsrcGroup fid_group(cricket::kFidSsrcGroupSemantics, fid_ssrcs); 331 cricket::SsrcGroup fid_group(cricket::kFidSsrcGroupSemantics, fid_ssrcs);
364 sp.ssrc_groups.push_back(fid_group); 332 sp.ssrc_groups.push_back(fid_group);
365 } 333 }
366 return sp; 334 return sp;
367 } 335 }
368 336
369 } // namespace cricket 337 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/base/testutils.h ('k') | webrtc/media/base/videobroadcaster.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698