OLD | NEW |
---|---|
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 Loading... | |
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( | |
375 "Media.VideoPixelFormat", stream->codec->pix_fmt, PIX_FMT_NB + 1); | |
scherkus (not reviewing)
2013/10/28 21:16:39
you're correct that since these values aren't guar
| |
376 UMA_HISTOGRAM_ENUMERATION("Media.VideoColorRange", | |
377 stream->codec->color_range, | |
378 AVCOL_RANGE_NB + 1); | |
379 } | |
380 | |
372 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt); | 381 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt); |
373 if (codec == kCodecVP9) { | 382 if (codec == kCodecVP9) { |
374 // TODO(tomfinegan): libavcodec doesn't know about VP9. | 383 // TODO(tomfinegan): libavcodec doesn't know about VP9. |
375 format = VideoFrame::YV12; | 384 format = VideoFrame::YV12; |
376 coded_size = natural_size; | 385 coded_size = natural_size; |
377 } | 386 } |
378 | 387 |
379 bool is_encrypted = false; | 388 bool is_encrypted = false; |
380 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0); | 389 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0); |
381 if (key) | 390 if (key) |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 return PIX_FMT_YUV420P; | 520 return PIX_FMT_YUV420P; |
512 case VideoFrame::YV12A: | 521 case VideoFrame::YV12A: |
513 return PIX_FMT_YUVA420P; | 522 return PIX_FMT_YUVA420P; |
514 default: | 523 default: |
515 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; | 524 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; |
516 } | 525 } |
517 return PIX_FMT_NONE; | 526 return PIX_FMT_NONE; |
518 } | 527 } |
519 | 528 |
520 } // namespace media | 529 } // namespace media |
OLD | NEW |