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/metrics/histogram.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 if (record_stats) { | 400 if (record_stats) { |
401 // Note the PRESUBMIT_IGNORE_UMA_MAX below, this silences the PRESUBMIT.py | 401 // Note the PRESUBMIT_IGNORE_UMA_MAX below, this silences the PRESUBMIT.py |
402 // check for uma enum max usage, since we're abusing | 402 // check for uma enum max usage, since we're abusing |
403 // UMA_HISTOGRAM_ENUMERATION to report a discrete value. | 403 // UMA_HISTOGRAM_ENUMERATION to report a discrete value. |
404 UMA_HISTOGRAM_ENUMERATION("Media.VideoColorRange", | 404 UMA_HISTOGRAM_ENUMERATION("Media.VideoColorRange", |
405 stream->codec->color_range, | 405 stream->codec->color_range, |
406 AVCOL_RANGE_NB); // PRESUBMIT_IGNORE_UMA_MAX | 406 AVCOL_RANGE_NB); // PRESUBMIT_IGNORE_UMA_MAX |
407 } | 407 } |
408 | 408 |
409 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt); | 409 VideoFrame::Format format = PixelFormatToVideoFormat(stream->codec->pix_fmt); |
| 410 // The format and coded size may be unknown if FFmpeg is compiled without |
| 411 // video decoders. |
| 412 #if defined(DISABLE_FFMPEG_VIDEO_DECODERS) |
| 413 if (format == VideoFrame::UNKNOWN) |
| 414 format = VideoFrame::YV12; |
| 415 if (coded_size == gfx::Size(0, 0)) |
| 416 coded_size = visible_rect.size(); |
| 417 #endif |
| 418 |
| 419 // TODO(tomfinegan): libavcodec doesn't know about VP9. |
410 if (codec == kCodecVP9) { | 420 if (codec == kCodecVP9) { |
411 // TODO(tomfinegan): libavcodec doesn't know about VP9. | |
412 format = VideoFrame::YV12; | 421 format = VideoFrame::YV12; |
413 coded_size = visible_rect.size(); | 422 coded_size = visible_rect.size(); |
414 } | 423 } |
415 | 424 |
416 // Pad out |coded_size| for subsampled YUV formats. | 425 // Pad out |coded_size| for subsampled YUV formats. |
417 if (format != VideoFrame::YV24) { | 426 if (format != VideoFrame::YV24) { |
418 coded_size.set_width((coded_size.width() + 1) / 2 * 2); | 427 coded_size.set_width((coded_size.width() + 1) / 2 * 2); |
419 if (format != VideoFrame::YV16) | 428 if (format != VideoFrame::YV16) |
420 coded_size.set_height((coded_size.height() + 1) / 2 * 2); | 429 coded_size.set_height((coded_size.height() + 1) / 2 * 2); |
421 } | 430 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 return false; | 607 return false; |
599 | 608 |
600 *out = parsed_time; | 609 *out = parsed_time; |
601 return true; | 610 return true; |
602 } | 611 } |
603 | 612 |
604 return false; | 613 return false; |
605 } | 614 } |
606 | 615 |
607 } // namespace media | 616 } // namespace media |
OLD | NEW |