Commit 6f185c3f authored by qinmin's avatar qinmin Committed by Commit bot

Passing key frame info flag renderer to browser process

For MediaSourcePlayer, we can use this flag to reduce the browser seek when codec is recreated.
Will implement the logic to reduce browser seek in a follow up CL.

BUG=304234

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

Cr-Commit-Position: refs/heads/master@{#313579}
parent 24c82bc3
......@@ -49,12 +49,13 @@ IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(media::AccessUnit)
IPC_STRUCT_TRAITS_MEMBER(status)
IPC_STRUCT_TRAITS_MEMBER(end_of_stream)
IPC_STRUCT_TRAITS_MEMBER(is_end_of_stream)
IPC_STRUCT_TRAITS_MEMBER(data)
IPC_STRUCT_TRAITS_MEMBER(timestamp)
IPC_STRUCT_TRAITS_MEMBER(key_id)
IPC_STRUCT_TRAITS_MEMBER(iv)
IPC_STRUCT_TRAITS_MEMBER(subsamples)
IPC_STRUCT_TRAITS_MEMBER(is_key_frame)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(media::SubsampleEntry)
......
......@@ -413,10 +413,11 @@ void MediaSourceDelegate::OnBufferReady(
case DemuxerStream::kOk:
data->access_units[index].status = status;
if (buffer->end_of_stream()) {
data->access_units[index].end_of_stream = true;
data->access_units[index].is_end_of_stream = true;
data->access_units.resize(index + 1);
break;
}
data->access_units[index].is_key_frame = buffer->is_key_frame();
// TODO(ycheo): We assume that the inputed stream will be decoded
// right away.
// Need to implement this properly using MediaPlayer.OnInfoListener.
......
......@@ -18,7 +18,7 @@ DemuxerConfigs::DemuxerConfigs()
DemuxerConfigs::~DemuxerConfigs() {}
AccessUnit::AccessUnit() : end_of_stream(false) {}
AccessUnit::AccessUnit() : is_end_of_stream(false), is_key_frame(false) {}
AccessUnit::~AccessUnit() {}
......
......@@ -41,13 +41,14 @@ struct MEDIA_EXPORT AccessUnit {
~AccessUnit();
DemuxerStream::Status status;
bool end_of_stream;
bool is_end_of_stream;
// TODO(ycheo): Use the shared memory to transfer the block data.
std::vector<uint8> data;
base::TimeDelta timestamp;
std::vector<char> key_id;
std::vector<char> iv;
std::vector<media::SubsampleEntry> subsamples;
bool is_key_frame;
};
struct MEDIA_EXPORT DemuxerData {
......
......@@ -45,7 +45,7 @@ MediaDecoderJob::MediaDecoderJob(
drm_bridge_(NULL),
drain_decoder_(false) {
InitializeReceivedData();
eos_unit_.end_of_stream = true;
eos_unit_.is_end_of_stream = true;
}
MediaDecoderJob::~MediaDecoderJob() {
......@@ -246,7 +246,7 @@ MediaCodecStatus MediaDecoderJob::QueueInputBuffer(const AccessUnit& unit) {
// TODO(qinmin): skip frames if video is falling far behind.
DCHECK_GE(input_buf_index, 0);
if (unit.end_of_stream || unit.data.empty()) {
if (unit.is_end_of_stream || unit.data.empty()) {
media_codec_bridge_->QueueEOS(input_buf_index);
return MEDIA_CODEC_INPUT_END_OF_STREAM;
}
......@@ -386,7 +386,7 @@ void MediaDecoderJob::DecodeInternal(
}
if (skip_eos_enqueue_) {
if (unit.end_of_stream || unit.data.empty()) {
if (unit.is_end_of_stream || unit.data.empty()) {
input_eos_encountered_ = true;
output_eos_encountered_ = true;
callback.Run(MEDIA_CODEC_OUTPUT_END_OF_STREAM, kNoTimestamp(),
......@@ -591,7 +591,7 @@ void MediaDecoderJob::RequestCurrentChunkIfEmpty() {
current_demuxer_data_index_ = inactive_demuxer_data_index();
const AccessUnit last_access_unit =
received_data_[current_demuxer_data_index_].access_units.back();
if (!last_access_unit.end_of_stream &&
if (!last_access_unit.is_end_of_stream &&
last_access_unit.status != DemuxerStream::kAborted) {
RequestData(base::Closure());
}
......
......@@ -423,7 +423,7 @@ class MediaSourcePlayerTest : public testing::Test {
data.type = is_audio ? DemuxerStream::AUDIO : DemuxerStream::VIDEO;
data.access_units.resize(1);
data.access_units[0].status = DemuxerStream::kOk;
data.access_units[0].end_of_stream = true;
data.access_units[0].is_end_of_stream = true;
return data;
}
......
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