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

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: 2121885f Rebase. Created 6 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 | 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 AVCOL_RANGE_NB); // PRESUBMIT_IGNORE_UMA_MAX 397 AVCOL_RANGE_NB); // PRESUBMIT_IGNORE_UMA_MAX
398 } 398 }
399 399
400 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt); 400 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt);
401 if (codec == kCodecVP9) { 401 if (codec == kCodecVP9) {
402 // TODO(tomfinegan): libavcodec doesn't know about VP9. 402 // TODO(tomfinegan): libavcodec doesn't know about VP9.
403 format = VideoFrame::YV12; 403 format = VideoFrame::YV12;
404 coded_size = natural_size; 404 coded_size = natural_size;
405 } 405 }
406 406
407 // Pad out |coded_size| for subsampled YUV formats.
408 coded_size.set_width((coded_size.width() + 1) / 2 * 2);
409 if (format != VideoFrame::YV16)
410 coded_size.set_height((coded_size.height() + 1) / 2 * 2);
411
407 bool is_encrypted = false; 412 bool is_encrypted = false;
408 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0); 413 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0);
409 if (key) 414 if (key)
410 is_encrypted = true; 415 is_encrypted = true;
411 416
412 AVDictionaryEntry* webm_alpha = 417 AVDictionaryEntry* webm_alpha =
413 av_dict_get(stream->metadata, "alpha_mode", NULL, 0); 418 av_dict_get(stream->metadata, "alpha_mode", NULL, 0);
414 if (webm_alpha && !strcmp(webm_alpha->value, "1")) { 419 if (webm_alpha && !strcmp(webm_alpha->value, "1")) {
415 format = VideoFrame::YV12A; 420 format = VideoFrame::YV12A;
416 } 421 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 return PIX_FMT_YUVJ420P; 544 return PIX_FMT_YUVJ420P;
540 case VideoFrame::YV12A: 545 case VideoFrame::YV12A:
541 return PIX_FMT_YUVA420P; 546 return PIX_FMT_YUVA420P;
542 default: 547 default:
543 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; 548 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format;
544 } 549 }
545 return PIX_FMT_NONE; 550 return PIX_FMT_NONE;
546 } 551 }
547 552
548 } // namespace media 553 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698