is_requesting_demuxer_data_ = false;
base::Closure done_cb = base::ResetAndReturn(&on_data_received_cb_);
+
+ // If this data request is for the inactive chunk, or |on_data_received_cb_|
+ // was set to null by ClearData() or Release(), do nothing.
+ if (done_cb.is_null())
+ return;
+
if (stop_decode_pending_) {
- OnDecodeCompleted(MEDIA_CODEC_STOPPED, kNoTimestamp(), 0);
+ DCHECK(is_decoding());
+ OnDecodeCompleted(MEDIA_CODEC_STOPPED, kNoTimestamp(), kNoTimestamp());
return;
}
- if (!done_cb.is_null())
- done_cb.Run();
+ done_cb.Run();
}
void MediaDecoderJob::Prefetch(const base::Closure& prefetch_cb) {
base::Bind(&MediaDecoderJob::OnDecodeCompleted,
base::Unretained(this),
MEDIA_CODEC_DEQUEUE_INPUT_AGAIN_LATER,
- kNoTimestamp(),
- 0));
+ kNoTimestamp(), kNoTimestamp()));
return;
}
output_eos_encountered_ = false;
MediaCodecStatus reset_status = media_codec_bridge_->Reset();
if (MEDIA_CODEC_OK != reset_status) {
- callback.Run(reset_status, kNoTimestamp(), 0);
+ callback.Run(reset_status, kNoTimestamp(), kNoTimestamp());
return;
}
}
// For aborted access unit, just skip it and inform the player.
if (unit.status == DemuxerStream::kAborted) {
// TODO(qinmin): use a new enum instead of MEDIA_CODEC_STOPPED.
- callback.Run(MEDIA_CODEC_STOPPED, kNoTimestamp(), 0);
+ callback.Run(MEDIA_CODEC_STOPPED, kNoTimestamp(), kNoTimestamp());
return;
}
if (unit.end_of_stream || unit.data.empty()) {
input_eos_encountered_ = true;
output_eos_encountered_ = true;
- callback.Run(MEDIA_CODEC_OUTPUT_END_OF_STREAM, kNoTimestamp(), 0);
+ callback.Run(MEDIA_CODEC_OUTPUT_END_OF_STREAM, kNoTimestamp(),
+ kNoTimestamp());
return;
}
if (input_status == MEDIA_CODEC_INPUT_END_OF_STREAM) {
input_eos_encountered_ = true;
} else if (input_status != MEDIA_CODEC_OK) {
- callback.Run(input_status, kNoTimestamp(), 0);
+ callback.Run(input_status, kNoTimestamp(), kNoTimestamp());
return;
}
}
!media_codec_bridge_->GetOutputBuffers()) {
status = MEDIA_CODEC_ERROR;
}
- callback.Run(status, kNoTimestamp(), 0);
+ callback.Run(status, kNoTimestamp(), kNoTimestamp());
return;
}
buffer_index,
size,
render_output,
- base::Bind(callback, status, presentation_timestamp)),
+ presentation_timestamp,
+ base::Bind(callback, status)),
time_to_render);
return;
}
presentation_timestamp = kNoTimestamp();
}
ReleaseOutputCompletionCallback completion_callback = base::Bind(
- callback, status, presentation_timestamp);
- ReleaseOutputBuffer(buffer_index, size, render_output, completion_callback);
+ callback, status);
+ ReleaseOutputBuffer(buffer_index, size, render_output, presentation_timestamp,
+ completion_callback);
}
void MediaDecoderJob::OnDecodeCompleted(
- MediaCodecStatus status, base::TimeDelta presentation_timestamp,
- size_t audio_output_bytes) {
+ MediaCodecStatus status, base::TimeDelta current_presentation_timestamp,
+ base::TimeDelta max_presentation_timestamp) {
DCHECK(ui_task_runner_->BelongsToCurrentThread());
if (destroy_pending_) {
DCHECK(!decode_cb_.is_null());
// If output was queued for rendering, then we have completed prerolling.
- if (presentation_timestamp != kNoTimestamp())
+ if (current_presentation_timestamp != kNoTimestamp())
prerolling_ = false;
switch (status) {
};
stop_decode_pending_ = false;
- base::ResetAndReturn(&decode_cb_).Run(status, presentation_timestamp,
- audio_output_bytes);
+ base::ResetAndReturn(&decode_cb_).Run(
+ status, current_presentation_timestamp, max_presentation_timestamp);
}
const AccessUnit& MediaDecoderJob::CurrentAccessUnit() const {