Commit 84034a92 authored by anjalibh@google.com's avatar anjalibh@google.com

Return an error on Multiple AUs in a PES.

HLS spec recommends a single access unit(AU) in a packetized elementary stream(PES) so that each access unit can
be assigned a unique PTS and DTS. The change makes es_parser_h264 return an error if the AU cannot be assigned a PTS and DTS.

BUG=254214

Review URL: https://codereview.chromium.org/136703005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245347 0039d316-1c4b-4281-b951-d872f2087c98
parent 234d110b
......@@ -216,7 +216,7 @@ bool EsParserH264::ParseInternal() {
// Emit a frame if needed.
if (nal_unit_type == kNalUnitTypeAUD)
EmitFrameIfNeeded(es_pos_);
RCHECK(EmitFrameIfNeeded(es_pos_));
// Skip the syncword.
es_pos_ += syncword_length;
......@@ -225,21 +225,24 @@ bool EsParserH264::ParseInternal() {
return true;
}
void EsParserH264::EmitFrameIfNeeded(int next_aud_pos) {
bool EsParserH264::EmitFrameIfNeeded(int next_aud_pos) {
// There is no current frame: start a new frame.
if (current_access_unit_pos_ < 0) {
StartFrame(next_aud_pos);
return;
return true;
}
// Get the access unit timing info.
TimingDesc current_timing_desc;
TimingDesc current_timing_desc = {kNoTimestamp(), kNoTimestamp()};
while (!timing_desc_list_.empty() &&
timing_desc_list_.front().first <= current_access_unit_pos_) {
current_timing_desc = timing_desc_list_.front().second;
timing_desc_list_.pop_front();
}
if (current_timing_desc.pts == kNoTimestamp())
return false;
// Emit a frame.
int raw_es_size;
const uint8* raw_es;
......@@ -256,6 +259,7 @@ void EsParserH264::EmitFrameIfNeeded(int next_aud_pos) {
// Set the current frame position to the next AUD position.
StartFrame(next_aud_pos);
return true;
}
void EsParserH264::StartFrame(int aud_pos) {
......
......@@ -55,7 +55,8 @@ class EsParserH264 : public EsParser {
bool ParseInternal();
// Emit a frame if a frame has been started earlier.
void EmitFrameIfNeeded(int next_aud_pos);
// Returns true if successful, false if no PTS is available for the frame.
bool EmitFrameIfNeeded(int next_aud_pos);
// Start a new frame.
// Note: if aud_pos < 0, clear the current frame.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment