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

Side by Side Diff: media/ffmpeg/ffmpeg_common.cc

Issue 178133005: Audit/fix use of media::VideoFrame::coded_size() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d4e1a5bd Uhh yeah. Created 6 years, 9 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 | Annotate | Revision Log
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 "media/ffmpeg/ffmpeg_common.h" 5 #include "media/ffmpeg/ffmpeg_common.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 AVCOL_RANGE_NB); 394 AVCOL_RANGE_NB);
395 } 395 }
396 396
397 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt); 397 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt);
398 if (codec == kCodecVP9) { 398 if (codec == kCodecVP9) {
399 // TODO(tomfinegan): libavcodec doesn't know about VP9. 399 // TODO(tomfinegan): libavcodec doesn't know about VP9.
400 format = VideoFrame::YV12; 400 format = VideoFrame::YV12;
401 coded_size = natural_size; 401 coded_size = natural_size;
402 } 402 }
403 403
404 // Pad out |coded_size| for subsampled YUV formats.
405 coded_size.set_width((coded_size.width() + 1) / 2 * 2);
406 if (format != VideoFrame::YV16)
407 coded_size.set_height((coded_size.height() + 1) / 2 * 2);
408
404 bool is_encrypted = false; 409 bool is_encrypted = false;
405 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0); 410 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0);
406 if (key) 411 if (key)
407 is_encrypted = true; 412 is_encrypted = true;
408 413
409 AVDictionaryEntry* webm_alpha = 414 AVDictionaryEntry* webm_alpha =
410 av_dict_get(stream->metadata, "alpha_mode", NULL, 0); 415 av_dict_get(stream->metadata, "alpha_mode", NULL, 0);
411 if (webm_alpha && !strcmp(webm_alpha->value, "1")) { 416 if (webm_alpha && !strcmp(webm_alpha->value, "1")) {
412 format = VideoFrame::YV12A; 417 format = VideoFrame::YV12A;
413 } 418 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 return PIX_FMT_YUVJ420P; 541 return PIX_FMT_YUVJ420P;
537 case VideoFrame::YV12A: 542 case VideoFrame::YV12A:
538 return PIX_FMT_YUVA420P; 543 return PIX_FMT_YUVA420P;
539 default: 544 default:
540 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; 545 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format;
541 } 546 }
542 return PIX_FMT_NONE; 547 return PIX_FMT_NONE;
543 } 548 }
544 549
545 } // namespace media 550 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698