summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamienv@chromium.org <damienv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-07 22:04:31 +0000
committerdamienv@chromium.org <damienv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-07 22:04:31 +0000
commit3b22fee65d2a1546f962d8e393271988c278a1ba (patch)
tree298d1f766efc958f614a3f2ccb4d72fe9fd055f4
parent9d6c91366bd216e0f22b8900d9d6a516cb12837a (diff)
downloadchromium_src-3b22fee65d2a1546f962d8e393271988c278a1ba.zip
chromium_src-3b22fee65d2a1546f962d8e393271988c278a1ba.tar.gz
chromium_src-3b22fee65d2a1546f962d8e393271988c278a1ba.tar.bz2
Support non square pixel aspect ratio in the Mp2t stream parser.
BUG=254214 Review URL: https://codereview.chromium.org/104833003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239350 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--media/mp2t/es_parser_h264.cc22
1 files changed, 10 insertions, 12 deletions
diff --git a/media/mp2t/es_parser_h264.cc b/media/mp2t/es_parser_h264.cc
index 99c2889..30764c9 100644
--- a/media/mp2t/es_parser_h264.cc
+++ b/media/mp2t/es_parser_h264.cc
@@ -19,11 +19,11 @@ static const int kExtendedSar = 255;
// ISO 14496 part 10
// VUI parameters: Table E-1 "Meaning of sample aspect ratio indicator"
static const int kTableSarWidth[14] = {
- 1, 1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160
+ 0, 1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160
};
static const int kTableSarHeight[14] = {
- 1, 1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99
+ 0, 1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99
};
// Remove the start code emulation prevention ( 0x000003 )
@@ -449,12 +449,8 @@ bool EsParserH264::ProcessSPS(const uint8* buf, int size) {
}
}
- if (sar_width != sar_height) {
- // TODO(damienv): Support non square pixels.
- DVLOG(1)
- << "Non square pixel not supported yet:"
- << " sar_width=" << sar_width
- << " sar_height=" << sar_height;
+ if (sar_width == 0 || sar_height == 0) {
+ DVLOG(1) << "Unspecified SAR not supported";
return false;
}
@@ -467,11 +463,12 @@ bool EsParserH264::ProcessSPS(const uint8* buf, int size) {
frame_crop_top_offset,
(coded_size.width() - frame_crop_right_offset) - frame_crop_left_offset,
(coded_size.height() - frame_crop_bottom_offset) - frame_crop_top_offset);
-
- // TODO(damienv): calculate the natural size based
- // on the possible aspect ratio coded in the VUI parameters.
- gfx::Size natural_size(visible_rect.width(),
+ if (visible_rect.width() <= 0 || visible_rect.height() <= 0)
+ return false;
+ gfx::Size natural_size((visible_rect.width() * sar_width) / sar_height,
visible_rect.height());
+ if (natural_size.width() == 0)
+ return false;
// TODO(damienv):
// Assuming the SPS is used right away by the PPS
@@ -495,6 +492,7 @@ bool EsParserH264::ProcessSPS(const uint8* buf, int size) {
DVLOG(1) << "Pic width: " << (pic_width_in_mbs_minus1 + 1) * 16;
DVLOG(1) << "Pic height: " << (pic_height_in_map_units_minus1 + 1) * 16;
DVLOG(1) << "log2_max_frame_num_minus4: " << log2_max_frame_num_minus4;
+ DVLOG(1) << "SAR: width=" << sar_width << " height=" << sar_height;
last_video_decoder_config_ = video_decoder_config;
new_video_config_cb_.Run(video_decoder_config);
}