2014-04-01 01:34:59 +00:00
|
|
|
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2014-10-01 22:10:21 +00:00
|
|
|
#include "packager/media/formats/mp2t/es_parser_h264.h"
|
2014-04-01 01:34:59 +00:00
|
|
|
|
2014-09-30 23:52:58 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2014-10-01 22:10:21 +00:00
|
|
|
#include "packager/base/logging.h"
|
|
|
|
#include "packager/base/numerics/safe_conversions.h"
|
|
|
|
#include "packager/media/base/media_sample.h"
|
|
|
|
#include "packager/media/base/offset_byte_queue.h"
|
|
|
|
#include "packager/media/base/timestamp.h"
|
|
|
|
#include "packager/media/base/video_stream_info.h"
|
2015-10-27 00:52:57 +00:00
|
|
|
#include "packager/media/filters/avc_decoder_configuration.h"
|
2014-10-01 22:10:21 +00:00
|
|
|
#include "packager/media/filters/h264_byte_to_unit_stream_converter.h"
|
|
|
|
#include "packager/media/filters/h264_parser.h"
|
|
|
|
#include "packager/media/formats/mp2t/mp2t_common.h"
|
2014-04-08 00:39:14 +00:00
|
|
|
|
2014-09-19 20:41:13 +00:00
|
|
|
namespace edash_packager {
|
2014-04-01 01:34:59 +00:00
|
|
|
namespace media {
|
|
|
|
namespace mp2t {
|
|
|
|
|
2014-04-08 00:39:14 +00:00
|
|
|
namespace {
|
|
|
|
|
2014-04-01 01:34:59 +00:00
|
|
|
// An AUD NALU is at least 4 bytes:
|
|
|
|
// 3 bytes for the start code + 1 byte for the NALU type.
|
|
|
|
const int kMinAUDSize = 4;
|
|
|
|
|
2014-04-08 00:39:14 +00:00
|
|
|
} // anonymous namespace
|
|
|
|
|
2014-09-30 21:52:21 +00:00
|
|
|
EsParserH264::EsParserH264(uint32_t pid,
|
|
|
|
const NewStreamInfoCB& new_stream_info_cb,
|
|
|
|
const EmitSampleCB& emit_sample_cb)
|
2014-04-10 19:57:10 +00:00
|
|
|
: EsParser(pid),
|
|
|
|
new_stream_info_cb_(new_stream_info_cb),
|
2014-04-08 00:39:14 +00:00
|
|
|
emit_sample_cb_(emit_sample_cb),
|
|
|
|
es_queue_(new media::OffsetByteQueue()),
|
|
|
|
h264_parser_(new H264Parser()),
|
|
|
|
current_access_unit_pos_(0),
|
2014-04-18 01:57:31 +00:00
|
|
|
next_access_unit_pos_(0),
|
|
|
|
stream_converter_(new H264ByteToUnitStreamConverter),
|
|
|
|
decoder_config_check_pending_(false),
|
2014-06-30 19:53:56 +00:00
|
|
|
pending_sample_duration_(0),
|
|
|
|
waiting_for_key_frame_(true) {
|
2014-04-01 01:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
EsParserH264::~EsParserH264() {
|
|
|
|
}
|
|
|
|
|
2014-09-30 21:52:21 +00:00
|
|
|
bool EsParserH264::Parse(const uint8_t* buf,
|
|
|
|
int size,
|
|
|
|
int64_t pts,
|
|
|
|
int64_t dts) {
|
2014-04-01 01:34:59 +00:00
|
|
|
// Note: Parse is invoked each time a PES packet has been reassembled.
|
|
|
|
// Unfortunately, a PES packet does not necessarily map
|
|
|
|
// to an h264 access unit, although the HLS recommendation is to use one PES
|
|
|
|
// for each access unit (but this is just a recommendation and some streams
|
|
|
|
// do not comply with this recommendation).
|
|
|
|
|
|
|
|
// HLS recommendation: "In AVC video, you should have both a DTS and a
|
|
|
|
// PTS in each PES header".
|
|
|
|
// However, some streams do not comply with this recommendation.
|
2014-04-08 00:39:14 +00:00
|
|
|
DVLOG_IF(1, pts == kNoTimestamp) << "Each video PES should have a PTS";
|
|
|
|
if (pts != kNoTimestamp) {
|
2014-04-01 01:34:59 +00:00
|
|
|
TimingDesc timing_desc;
|
|
|
|
timing_desc.pts = pts;
|
2014-04-08 00:39:14 +00:00
|
|
|
timing_desc.dts = (dts != kNoTimestamp) ? dts : pts;
|
2014-04-01 01:34:59 +00:00
|
|
|
|
|
|
|
// Link the end of the byte queue with the incoming timing descriptor.
|
|
|
|
timing_desc_list_.push_back(
|
2014-09-30 21:52:21 +00:00
|
|
|
std::pair<int64_t, TimingDesc>(es_queue_->tail(), timing_desc));
|
2014-04-01 01:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add the incoming bytes to the ES queue.
|
|
|
|
es_queue_->Push(buf, size);
|
|
|
|
return ParseInternal();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EsParserH264::Flush() {
|
|
|
|
DVLOG(1) << "EsParserH264::Flush";
|
2014-04-18 01:57:31 +00:00
|
|
|
|
|
|
|
if (FindAUD(¤t_access_unit_pos_)) {
|
|
|
|
// Simulate an additional AUD to force emitting the last access unit
|
|
|
|
// which is assumed to be complete at this point.
|
2014-09-30 21:52:21 +00:00
|
|
|
uint8_t aud[] = {0x00, 0x00, 0x01, 0x09};
|
2014-04-18 01:57:31 +00:00
|
|
|
es_queue_->Push(aud, sizeof(aud));
|
|
|
|
ParseInternal();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pending_sample_) {
|
|
|
|
// Flush pending sample.
|
|
|
|
DCHECK(pending_sample_duration_);
|
|
|
|
pending_sample_->set_duration(pending_sample_duration_);
|
|
|
|
emit_sample_cb_.Run(pid(), pending_sample_);
|
|
|
|
pending_sample_ = scoped_refptr<MediaSample>();
|
|
|
|
}
|
2014-04-01 01:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EsParserH264::Reset() {
|
|
|
|
DVLOG(1) << "EsParserH264::Reset";
|
|
|
|
es_queue_.reset(new media::OffsetByteQueue());
|
|
|
|
h264_parser_.reset(new H264Parser());
|
|
|
|
current_access_unit_pos_ = 0;
|
|
|
|
next_access_unit_pos_ = 0;
|
|
|
|
timing_desc_list_.clear();
|
2014-04-10 19:57:10 +00:00
|
|
|
last_video_decoder_config_ = scoped_refptr<StreamInfo>();
|
2014-04-18 01:57:31 +00:00
|
|
|
decoder_config_check_pending_ = false;
|
|
|
|
pending_sample_ = scoped_refptr<MediaSample>();
|
|
|
|
pending_sample_duration_ = 0;
|
2014-06-30 19:53:56 +00:00
|
|
|
waiting_for_key_frame_ = true;
|
2014-04-01 01:34:59 +00:00
|
|
|
}
|
|
|
|
|
2014-09-30 21:52:21 +00:00
|
|
|
bool EsParserH264::FindAUD(int64_t* stream_pos) {
|
2014-04-01 01:34:59 +00:00
|
|
|
while (true) {
|
2014-09-30 21:52:21 +00:00
|
|
|
const uint8_t* es;
|
2014-04-01 01:34:59 +00:00
|
|
|
int size;
|
|
|
|
es_queue_->PeekAt(*stream_pos, &es, &size);
|
|
|
|
|
|
|
|
// Find a start code and move the stream to the start code parser position.
|
2016-02-05 19:08:07 +00:00
|
|
|
uint64_t start_code_offset;
|
|
|
|
uint8_t start_code_size;
|
|
|
|
bool start_code_found = NaluReader::FindStartCode(
|
2014-04-01 01:34:59 +00:00
|
|
|
es, size, &start_code_offset, &start_code_size);
|
|
|
|
*stream_pos += start_code_offset;
|
|
|
|
|
|
|
|
// No H264 start code found or NALU type not available yet.
|
2016-02-05 19:08:07 +00:00
|
|
|
if (!start_code_found ||
|
|
|
|
start_code_offset + start_code_size >= static_cast<uint64_t>(size)) {
|
2014-04-01 01:34:59 +00:00
|
|
|
return false;
|
2016-02-05 19:08:07 +00:00
|
|
|
}
|
2014-04-01 01:34:59 +00:00
|
|
|
|
|
|
|
// Exit the parser loop when an AUD is found.
|
|
|
|
// Note: NALU header for an AUD:
|
2016-02-05 19:08:07 +00:00
|
|
|
// - ref_idc must be 0
|
|
|
|
// - type must be Nalu::H264_AUD
|
|
|
|
if (es[start_code_offset + start_code_size] == Nalu::H264_AUD)
|
2014-04-01 01:34:59 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
// The current NALU is not an AUD, skip the start code
|
|
|
|
// and continue parsing the stream.
|
|
|
|
*stream_pos += start_code_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EsParserH264::ParseInternal() {
|
|
|
|
DCHECK_LE(es_queue_->head(), current_access_unit_pos_);
|
|
|
|
DCHECK_LE(current_access_unit_pos_, next_access_unit_pos_);
|
|
|
|
DCHECK_LE(next_access_unit_pos_, es_queue_->tail());
|
|
|
|
|
|
|
|
// Find the next AUD located at or after |current_access_unit_pos_|. This is
|
|
|
|
// needed since initially |current_access_unit_pos_| might not point to
|
|
|
|
// an AUD.
|
|
|
|
// Discard all the data before the updated |current_access_unit_pos_|
|
|
|
|
// since it won't be used again.
|
|
|
|
bool aud_found = FindAUD(¤t_access_unit_pos_);
|
|
|
|
es_queue_->Trim(current_access_unit_pos_);
|
|
|
|
if (next_access_unit_pos_ < current_access_unit_pos_)
|
|
|
|
next_access_unit_pos_ = current_access_unit_pos_;
|
|
|
|
|
|
|
|
// Resume parsing later if no AUD was found.
|
|
|
|
if (!aud_found)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// Find the next AUD to make sure we have a complete access unit.
|
|
|
|
if (next_access_unit_pos_ < current_access_unit_pos_ + kMinAUDSize) {
|
|
|
|
next_access_unit_pos_ = current_access_unit_pos_ + kMinAUDSize;
|
|
|
|
DCHECK_LE(next_access_unit_pos_, es_queue_->tail());
|
|
|
|
}
|
|
|
|
if (!FindAUD(&next_access_unit_pos_))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// At this point, we know we have a full access unit.
|
|
|
|
bool is_key_frame = false;
|
|
|
|
int pps_id_for_access_unit = -1;
|
|
|
|
|
2014-09-30 21:52:21 +00:00
|
|
|
const uint8_t* es;
|
2014-04-01 01:34:59 +00:00
|
|
|
int size;
|
|
|
|
es_queue_->PeekAt(current_access_unit_pos_, &es, &size);
|
2014-09-30 21:52:21 +00:00
|
|
|
int access_unit_size = base::checked_cast<int, int64_t>(
|
2014-04-01 01:34:59 +00:00
|
|
|
next_access_unit_pos_ - current_access_unit_pos_);
|
|
|
|
DCHECK_LE(access_unit_size, size);
|
2016-02-05 19:08:07 +00:00
|
|
|
NaluReader reader(kIsAnnexbByteStream, es, access_unit_size);
|
2014-04-01 01:34:59 +00:00
|
|
|
|
|
|
|
while (true) {
|
2016-02-05 19:08:07 +00:00
|
|
|
Nalu nalu;
|
2014-04-01 01:34:59 +00:00
|
|
|
bool is_eos = false;
|
2016-02-05 19:08:07 +00:00
|
|
|
switch (reader.Advance(&nalu)) {
|
|
|
|
case NaluReader::kOk:
|
2014-04-01 01:34:59 +00:00
|
|
|
break;
|
2016-02-05 19:08:07 +00:00
|
|
|
case NaluReader::kEOStream:
|
2014-04-01 01:34:59 +00:00
|
|
|
is_eos = true;
|
|
|
|
break;
|
2016-02-05 19:08:07 +00:00
|
|
|
default:
|
|
|
|
return false;
|
2014-04-01 01:34:59 +00:00
|
|
|
}
|
|
|
|
if (is_eos)
|
|
|
|
break;
|
|
|
|
|
2016-02-05 19:08:07 +00:00
|
|
|
switch (nalu.type()) {
|
|
|
|
case Nalu::H264_AUD: {
|
|
|
|
DVLOG(LOG_LEVEL_ES) << "Nalu: AUD";
|
2014-04-01 01:34:59 +00:00
|
|
|
break;
|
|
|
|
}
|
2016-02-05 19:08:07 +00:00
|
|
|
case Nalu::H264_SPS: {
|
|
|
|
DVLOG(LOG_LEVEL_ES) << "Nalu: SPS";
|
2014-04-01 01:34:59 +00:00
|
|
|
int sps_id;
|
2016-02-05 19:08:07 +00:00
|
|
|
if (h264_parser_->ParseSPS(nalu, &sps_id) != H264Parser::kOk)
|
2014-04-01 01:34:59 +00:00
|
|
|
return false;
|
2014-04-18 01:57:31 +00:00
|
|
|
decoder_config_check_pending_ = true;
|
2014-04-01 01:34:59 +00:00
|
|
|
break;
|
|
|
|
}
|
2016-02-05 19:08:07 +00:00
|
|
|
case Nalu::H264_PPS: {
|
|
|
|
DVLOG(LOG_LEVEL_ES) << "Nalu: PPS";
|
2014-04-01 01:34:59 +00:00
|
|
|
int pps_id;
|
2016-02-05 19:08:07 +00:00
|
|
|
if (h264_parser_->ParsePPS(nalu, &pps_id) != H264Parser::kOk) {
|
2014-07-01 23:15:59 +00:00
|
|
|
// Allow PPS parsing to fail if waiting for SPS.
|
|
|
|
if (last_video_decoder_config_)
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
decoder_config_check_pending_ = true;
|
|
|
|
}
|
2014-04-01 01:34:59 +00:00
|
|
|
break;
|
|
|
|
}
|
2016-02-05 19:08:07 +00:00
|
|
|
case Nalu::H264_IDRSlice:
|
|
|
|
case Nalu::H264_NonIDRSlice: {
|
|
|
|
is_key_frame = (nalu.type() == Nalu::H264_IDRSlice);
|
|
|
|
DVLOG(LOG_LEVEL_ES) << "Nalu: slice IDR=" << is_key_frame;
|
2014-04-01 01:34:59 +00:00
|
|
|
H264SliceHeader shdr;
|
|
|
|
if (h264_parser_->ParseSliceHeader(nalu, &shdr) != H264Parser::kOk) {
|
|
|
|
// Only accept an invalid SPS/PPS at the beginning when the stream
|
|
|
|
// does not necessarily start with an SPS/PPS/IDR.
|
2014-04-08 00:39:14 +00:00
|
|
|
if (last_video_decoder_config_)
|
2014-04-01 01:34:59 +00:00
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
pps_id_for_access_unit = shdr.pic_parameter_set_id;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
2016-02-05 19:08:07 +00:00
|
|
|
DVLOG(LOG_LEVEL_ES) << "Nalu: " << nalu.type();
|
2014-04-01 01:34:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-30 19:53:56 +00:00
|
|
|
if (waiting_for_key_frame_) {
|
|
|
|
waiting_for_key_frame_ = !is_key_frame;
|
|
|
|
}
|
|
|
|
if (!waiting_for_key_frame_) {
|
|
|
|
// Emit a frame and move the stream to the next AUD position.
|
|
|
|
RCHECK(EmitFrame(current_access_unit_pos_, access_unit_size,
|
|
|
|
is_key_frame, pps_id_for_access_unit));
|
|
|
|
}
|
2014-04-01 01:34:59 +00:00
|
|
|
current_access_unit_pos_ = next_access_unit_pos_;
|
|
|
|
es_queue_->Trim(current_access_unit_pos_);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-30 21:52:21 +00:00
|
|
|
bool EsParserH264::EmitFrame(int64_t access_unit_pos,
|
|
|
|
int access_unit_size,
|
|
|
|
bool is_key_frame,
|
|
|
|
int pps_id) {
|
2014-04-01 01:34:59 +00:00
|
|
|
// Get the access unit timing info.
|
2014-04-08 00:39:14 +00:00
|
|
|
TimingDesc current_timing_desc = {kNoTimestamp, kNoTimestamp};
|
2014-04-01 01:34:59 +00:00
|
|
|
while (!timing_desc_list_.empty() &&
|
|
|
|
timing_desc_list_.front().first <= access_unit_pos) {
|
|
|
|
current_timing_desc = timing_desc_list_.front().second;
|
|
|
|
timing_desc_list_.pop_front();
|
|
|
|
}
|
2014-04-08 00:39:14 +00:00
|
|
|
if (current_timing_desc.pts == kNoTimestamp)
|
2014-04-01 01:34:59 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
// Emit a frame.
|
|
|
|
DVLOG(LOG_LEVEL_ES) << "Emit frame: stream_pos=" << current_access_unit_pos_
|
|
|
|
<< " size=" << access_unit_size;
|
|
|
|
int es_size;
|
2014-09-30 21:52:21 +00:00
|
|
|
const uint8_t* es;
|
2014-04-01 01:34:59 +00:00
|
|
|
es_queue_->PeekAt(current_access_unit_pos_, &es, &es_size);
|
|
|
|
CHECK_GE(es_size, access_unit_size);
|
|
|
|
|
2014-04-18 01:57:31 +00:00
|
|
|
// Convert frame to unit stream format.
|
2014-09-30 21:52:21 +00:00
|
|
|
std::vector<uint8_t> converted_frame;
|
2014-04-18 01:57:31 +00:00
|
|
|
if (!stream_converter_->ConvertByteStreamToNalUnitStream(
|
|
|
|
es, access_unit_size, &converted_frame)) {
|
|
|
|
DLOG(ERROR) << "Failure to convert video frame to unit stream format.";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (decoder_config_check_pending_) {
|
|
|
|
// Update the video decoder configuration if needed.
|
|
|
|
const H264PPS* pps = h264_parser_->GetPPS(pps_id);
|
|
|
|
if (!pps) {
|
|
|
|
// Only accept an invalid PPS at the beginning when the stream
|
|
|
|
// does not necessarily start with an SPS/PPS/IDR.
|
|
|
|
// In this case, the initial frames are conveyed to the upper layer with
|
|
|
|
// an invalid VideoDecoderConfig and it's up to the upper layer
|
|
|
|
// to process this kind of frame accordingly.
|
|
|
|
if (last_video_decoder_config_)
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
const H264SPS* sps = h264_parser_->GetSPS(pps->seq_parameter_set_id);
|
|
|
|
if (!sps)
|
|
|
|
return false;
|
|
|
|
RCHECK(UpdateVideoDecoderConfig(sps));
|
|
|
|
decoder_config_check_pending_ = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create the media sample, emitting always the previous sample after
|
|
|
|
// calculating its duration.
|
|
|
|
scoped_refptr<MediaSample> media_sample = MediaSample::CopyFrom(
|
|
|
|
converted_frame.data(), converted_frame.size(), is_key_frame);
|
2014-04-08 00:39:14 +00:00
|
|
|
media_sample->set_dts(current_timing_desc.dts);
|
|
|
|
media_sample->set_pts(current_timing_desc.pts);
|
2014-04-18 01:57:31 +00:00
|
|
|
if (pending_sample_) {
|
|
|
|
DCHECK_GT(media_sample->dts(), pending_sample_->dts());
|
|
|
|
pending_sample_duration_ = media_sample->dts() - pending_sample_->dts();
|
|
|
|
pending_sample_->set_duration(pending_sample_duration_);
|
|
|
|
emit_sample_cb_.Run(pid(), pending_sample_);
|
|
|
|
}
|
|
|
|
pending_sample_ = media_sample;
|
|
|
|
|
2014-04-01 01:34:59 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EsParserH264::UpdateVideoDecoderConfig(const H264SPS* sps) {
|
2014-09-30 21:52:21 +00:00
|
|
|
std::vector<uint8_t> decoder_config_record;
|
2014-04-18 01:57:31 +00:00
|
|
|
if (!stream_converter_->GetAVCDecoderConfigurationRecord(
|
|
|
|
&decoder_config_record)) {
|
|
|
|
DLOG(ERROR) << "Failure to construct an AVCDecoderConfigurationRecord";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-04-08 00:39:14 +00:00
|
|
|
if (last_video_decoder_config_) {
|
2014-05-29 20:21:28 +00:00
|
|
|
if (last_video_decoder_config_->extra_data() != decoder_config_record) {
|
|
|
|
// Video configuration has changed. Issue warning.
|
|
|
|
// TODO(tinskip): Check the nature of the configuration change. Only
|
|
|
|
// minor configuration changes (such as frame ordering) can be handled
|
|
|
|
// gracefully by decoders without notification. Major changes (such as
|
|
|
|
// video resolution changes) should be treated as errors.
|
|
|
|
LOG(WARNING) << "H.264 decoder configuration has changed.";
|
|
|
|
last_video_decoder_config_->set_extra_data(decoder_config_record);
|
2014-04-18 01:57:31 +00:00
|
|
|
}
|
2014-05-29 20:21:28 +00:00
|
|
|
return true;
|
2014-04-08 00:39:14 +00:00
|
|
|
}
|
2014-04-01 01:34:59 +00:00
|
|
|
|
2015-09-16 22:22:22 +00:00
|
|
|
uint32_t coded_width = 0;
|
|
|
|
uint32_t coded_height = 0;
|
|
|
|
uint32_t pixel_width = 0;
|
|
|
|
uint32_t pixel_height = 0;
|
|
|
|
if (!ExtractResolutionFromSps(*sps, &coded_width, &coded_height, &pixel_width,
|
|
|
|
&pixel_height)) {
|
|
|
|
LOG(ERROR) << "Failed to parse SPS.";
|
|
|
|
return false;
|
|
|
|
}
|
2014-04-08 00:39:14 +00:00
|
|
|
|
2014-04-10 19:57:10 +00:00
|
|
|
last_video_decoder_config_ = scoped_refptr<StreamInfo>(
|
2014-04-08 00:39:14 +00:00
|
|
|
new VideoStreamInfo(
|
2014-04-10 19:57:10 +00:00
|
|
|
pid(),
|
2014-04-08 00:39:14 +00:00
|
|
|
kMpeg2Timescale,
|
|
|
|
kInfiniteDuration,
|
|
|
|
kCodecH264,
|
2015-10-27 00:52:57 +00:00
|
|
|
AVCDecoderConfiguration::GetCodecString(decoder_config_record[1],
|
|
|
|
decoder_config_record[2],
|
|
|
|
decoder_config_record[3]),
|
2014-04-08 00:39:14 +00:00
|
|
|
std::string(),
|
2015-09-16 22:22:22 +00:00
|
|
|
coded_width,
|
|
|
|
coded_height,
|
|
|
|
pixel_width,
|
|
|
|
pixel_height,
|
2015-06-02 21:41:49 +00:00
|
|
|
0,
|
2014-04-18 01:57:31 +00:00
|
|
|
H264ByteToUnitStreamConverter::kUnitStreamNaluLengthSize,
|
|
|
|
decoder_config_record.data(),
|
|
|
|
decoder_config_record.size(),
|
2014-04-08 00:39:14 +00:00
|
|
|
false));
|
|
|
|
DVLOG(1) << "Profile IDC: " << sps->profile_idc;
|
|
|
|
DVLOG(1) << "Level IDC: " << sps->level_idc;
|
2015-09-16 22:22:22 +00:00
|
|
|
DVLOG(1) << "log2_max_frame_num_minus4: " << sps->log2_max_frame_num_minus4;
|
2014-04-08 00:39:14 +00:00
|
|
|
|
|
|
|
// Video config notification.
|
2014-04-10 19:57:10 +00:00
|
|
|
new_stream_info_cb_.Run(last_video_decoder_config_);
|
2014-04-01 01:34:59 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace mp2t
|
|
|
|
} // namespace media
|
2014-09-19 20:41:13 +00:00
|
|
|
} // namespace edash_packager
|