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

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

Issue 45053003: Add UMA metrics for ffmpeg color ranges. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Log VideoFrame::Format, instead of ffmpeg's AvPixelFormat. Created 7 years, 1 month 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/base/video_frame.h ('k') | tools/metrics/histograms/histograms.xml » ('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 "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 "media/base/decoder_buffer.h" 10 #include "media/base/decoder_buffer.h"
10 #include "media/base/video_frame.h" 11 #include "media/base/video_frame.h"
11 #include "media/base/video_util.h" 12 #include "media/base/video_util.h"
12 13
13 namespace media { 14 namespace media {
14 15
15 // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are 16 // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
16 // padded. Check here to ensure FFmpeg only receives data padded to its 17 // padded. Check here to ensure FFmpeg only receives data padded to its
17 // specifications. 18 // specifications.
18 COMPILE_ASSERT(DecoderBuffer::kPaddingSize >= FF_INPUT_BUFFER_PADDING_SIZE, 19 COMPILE_ASSERT(DecoderBuffer::kPaddingSize >= FF_INPUT_BUFFER_PADDING_SIZE,
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 if (codec == kCodecVP8) 363 if (codec == kCodecVP8)
363 profile = VP8PROFILE_MAIN; 364 profile = VP8PROFILE_MAIN;
364 else if (codec == kCodecVP9) 365 else if (codec == kCodecVP9)
365 profile = VP9PROFILE_MAIN; 366 profile = VP9PROFILE_MAIN;
366 else 367 else
367 profile = ProfileIDToVideoCodecProfile(stream->codec->profile); 368 profile = ProfileIDToVideoCodecProfile(stream->codec->profile);
368 369
369 gfx::Size natural_size = GetNaturalSize( 370 gfx::Size natural_size = GetNaturalSize(
370 visible_rect.size(), aspect_ratio.num, aspect_ratio.den); 371 visible_rect.size(), aspect_ratio.num, aspect_ratio.den);
371 372
373 if (record_stats) {
374 UMA_HISTOGRAM_ENUMERATION("Media.VideoColorRange",
375 stream->codec->color_range,
376 AVCOL_RANGE_NB + 1);
scherkus (not reviewing) 2013/10/29 00:36:31 should this be AVCOL_RANGE_NB as opposed to AVCOL_
377 }
378
372 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt); 379 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt);
373 if (codec == kCodecVP9) { 380 if (codec == kCodecVP9) {
374 // TODO(tomfinegan): libavcodec doesn't know about VP9. 381 // TODO(tomfinegan): libavcodec doesn't know about VP9.
375 format = VideoFrame::YV12; 382 format = VideoFrame::YV12;
376 coded_size = natural_size; 383 coded_size = natural_size;
377 } 384 }
378 385
379 bool is_encrypted = false; 386 bool is_encrypted = false;
380 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0); 387 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0);
381 if (key) 388 if (key)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 return PIX_FMT_YUV420P; 518 return PIX_FMT_YUV420P;
512 case VideoFrame::YV12A: 519 case VideoFrame::YV12A:
513 return PIX_FMT_YUVA420P; 520 return PIX_FMT_YUVA420P;
514 default: 521 default:
515 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; 522 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format;
516 } 523 }
517 return PIX_FMT_NONE; 524 return PIX_FMT_NONE;
518 } 525 }
519 526
520 } // namespace media 527 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698