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 "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
10 #include "media/base/decoder_buffer.h" | 11 #include "media/base/decoder_buffer.h" |
11 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
12 #include "media/base/video_util.h" | 13 #include "media/base/video_util.h" |
13 | 14 |
14 namespace media { | 15 namespace media { |
15 | 16 |
16 // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are | 17 // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are |
17 // padded. Check here to ensure FFmpeg only receives data padded to its | 18 // padded. Check here to ensure FFmpeg only receives data padded to its |
18 // specifications. | 19 // specifications. |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 if (codec == kCodecVP8) | 376 if (codec == kCodecVP8) |
376 profile = VP8PROFILE_MAIN; | 377 profile = VP8PROFILE_MAIN; |
377 else if (codec == kCodecVP9) | 378 else if (codec == kCodecVP9) |
378 profile = VP9PROFILE_MAIN; | 379 profile = VP9PROFILE_MAIN; |
379 else | 380 else |
380 profile = ProfileIDToVideoCodecProfile(stream->codec->profile); | 381 profile = ProfileIDToVideoCodecProfile(stream->codec->profile); |
381 | 382 |
382 gfx::Size natural_size = GetNaturalSize( | 383 gfx::Size natural_size = GetNaturalSize( |
383 visible_rect.size(), aspect_ratio.num, aspect_ratio.den); | 384 visible_rect.size(), aspect_ratio.num, aspect_ratio.den); |
384 | 385 |
| 386 if (record_stats) { |
| 387 UMA_HISTOGRAM_ENUMERATION("Media.VideoColorRange", |
| 388 stream->codec->color_range, |
| 389 AVCOL_RANGE_NB); |
| 390 } |
| 391 |
385 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt); | 392 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt); |
386 if (codec == kCodecVP9) { | 393 if (codec == kCodecVP9) { |
387 // TODO(tomfinegan): libavcodec doesn't know about VP9. | 394 // TODO(tomfinegan): libavcodec doesn't know about VP9. |
388 format = VideoFrame::YV12; | 395 format = VideoFrame::YV12; |
389 coded_size = natural_size; | 396 coded_size = natural_size; |
390 } | 397 } |
391 | 398 |
392 bool is_encrypted = false; | 399 bool is_encrypted = false; |
393 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0); | 400 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0); |
394 if (key) | 401 if (key) |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 return PIX_FMT_YUV420P; | 531 return PIX_FMT_YUV420P; |
525 case VideoFrame::YV12A: | 532 case VideoFrame::YV12A: |
526 return PIX_FMT_YUVA420P; | 533 return PIX_FMT_YUVA420P; |
527 default: | 534 default: |
528 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; | 535 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; |
529 } | 536 } |
530 return PIX_FMT_NONE; | 537 return PIX_FMT_NONE; |
531 } | 538 } |
532 | 539 |
533 } // namespace media | 540 } // namespace media |
OLD | NEW |