Chromium Code Reviews| 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 if (codec == kCodecVP9) { | 410 // The format and coded size may be unknown by FFmpeg for VP9, and on Android |
| 411 // TODO(tomfinegan): libavcodec doesn't know about VP9. | 411 // where FFmpeg is compiled without parsers. |
|
liberato (no reviews please)
2015/07/10 17:15:09
maybe keep the TODO.
| |
| 412 if (format == VideoFrame::UNKNOWN) | |
|
liberato (no reviews please)
2015/07/10 17:15:09
setting any unknown format to YV12 seems like it c
watk
2015/07/10 18:51:26
AFAIK this is ok, but I'm not sure enough, so I'll
| |
| 412 format = VideoFrame::YV12; | 413 format = VideoFrame::YV12; |
| 414 if (coded_size == gfx::Size(0, 0)) | |
|
liberato (no reviews please)
2015/07/10 17:15:09
also seems scary to do for any unknown size.
watk
2015/07/10 18:51:25
Done.
| |
| 413 coded_size = visible_rect.size(); | 415 coded_size = visible_rect.size(); |
| 414 } | |
| 415 | 416 |
| 416 // Pad out |coded_size| for subsampled YUV formats. | 417 // Pad out |coded_size| for subsampled YUV formats. |
| 417 if (format != VideoFrame::YV24) { | 418 if (format != VideoFrame::YV24) { |
| 418 coded_size.set_width((coded_size.width() + 1) / 2 * 2); | 419 coded_size.set_width((coded_size.width() + 1) / 2 * 2); |
| 419 if (format != VideoFrame::YV16) | 420 if (format != VideoFrame::YV16) |
| 420 coded_size.set_height((coded_size.height() + 1) / 2 * 2); | 421 coded_size.set_height((coded_size.height() + 1) / 2 * 2); |
| 421 } | 422 } |
| 422 | 423 |
| 423 bool is_encrypted = false; | 424 bool is_encrypted = false; |
| 424 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0); | 425 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 598 return false; | 599 return false; |
| 599 | 600 |
| 600 *out = parsed_time; | 601 *out = parsed_time; |
| 601 return true; | 602 return true; |
| 602 } | 603 } |
| 603 | 604 |
| 604 return false; | 605 return false; |
| 605 } | 606 } |
| 606 | 607 |
| 607 } // namespace media | 608 } // namespace media |
| OLD | NEW |