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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 coded_size = visible_rect.size(); | 499 coded_size = visible_rect.size(); |
500 } | 500 } |
501 | 501 |
502 // Pad out |coded_size| for subsampled YUV formats. | 502 // Pad out |coded_size| for subsampled YUV formats. |
503 if (format != PIXEL_FORMAT_YV24) { | 503 if (format != PIXEL_FORMAT_YV24) { |
504 coded_size.set_width((coded_size.width() + 1) / 2 * 2); | 504 coded_size.set_width((coded_size.width() + 1) / 2 * 2); |
505 if (format != PIXEL_FORMAT_YV16) | 505 if (format != PIXEL_FORMAT_YV16) |
506 coded_size.set_height((coded_size.height() + 1) / 2 * 2); | 506 coded_size.set_height((coded_size.height() + 1) / 2 * 2); |
507 } | 507 } |
508 | 508 |
509 AVDictionaryEntry* webm_alpha = | 509 // H264 doesn't support alpha mode. |
510 av_dict_get(stream->metadata, "alpha_mode", nullptr, 0); | 510 if (codec != kCodecH264) { |
emircan
2017/04/07 17:33:04
Why is this necessary? Is there problem with playi
braveyao
2017/04/08 00:56:26
Yes there is problem with playing back H264 record
emircan
2017/04/10 21:18:09
Alpha recording would only happen for WebM/VPx as
braveyao
2017/04/14 22:28:28
I don't understand your concern here.
Since HW H26
emircan
2017/04/17 17:24:06
Note: This issue was resolved on https://coderevie
braveyao
2017/04/17 18:09:27
Acknowledged.
| |
511 if (webm_alpha && !strcmp(webm_alpha->value, "1")) { | 511 AVDictionaryEntry* webm_alpha = |
512 format = PIXEL_FORMAT_YV12A; | 512 av_dict_get(stream->metadata, "alpha_mode", nullptr, 0); |
513 if (webm_alpha && !strcmp(webm_alpha->value, "1")) { | |
514 format = PIXEL_FORMAT_YV12A; | |
515 } | |
513 } | 516 } |
514 | 517 |
515 // Prefer the color space found by libavcodec if available. | 518 // Prefer the color space found by libavcodec if available. |
516 ColorSpace color_space = AVColorSpaceToColorSpace(codec_context->colorspace, | 519 ColorSpace color_space = AVColorSpaceToColorSpace(codec_context->colorspace, |
517 codec_context->color_range); | 520 codec_context->color_range); |
518 if (color_space == COLOR_SPACE_UNSPECIFIED) { | 521 if (color_space == COLOR_SPACE_UNSPECIFIED) { |
519 // Otherwise, assume that SD video is usually Rec.601, and HD is usually | 522 // Otherwise, assume that SD video is usually Rec.601, and HD is usually |
520 // Rec.709. | 523 // Rec.709. |
521 color_space = (natural_size.height() < 720) ? COLOR_SPACE_SD_REC601 | 524 color_space = (natural_size.height() < 720) ? COLOR_SPACE_SD_REC601 |
522 : COLOR_SPACE_HD_REC709; | 525 : COLOR_SPACE_HD_REC709; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
751 } | 754 } |
752 | 755 |
753 int32_t HashCodecName(const char* codec_name) { | 756 int32_t HashCodecName(const char* codec_name) { |
754 // Use the first 32-bits from the SHA1 hash as the identifier. | 757 // Use the first 32-bits from the SHA1 hash as the identifier. |
755 int32_t hash; | 758 int32_t hash; |
756 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); | 759 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); |
757 return hash; | 760 return hash; |
758 } | 761 } |
759 | 762 |
760 } // namespace media | 763 } // namespace media |
OLD | NEW |