Index: media/filters/source_buffer_stream.cc |
diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc |
index ab6b4eea38f3940a302ee1ba8a746d421ed76984..e2c5218f43ffa3638a70b8f76d8772398b8c1d95 100644 |
--- a/media/filters/source_buffer_stream.cc |
+++ b/media/filters/source_buffer_stream.cc |
@@ -94,9 +94,9 @@ static SourceBufferRange::GapPolicy TypeToGapPolicy( |
} |
SourceBufferStream::SourceBufferStream(const AudioDecoderConfig& audio_config, |
- const LogCB& log_cb, |
+ const scoped_refptr<MediaLog>& media_log, |
bool splice_frames_enabled) |
- : log_cb_(log_cb), |
+ : media_log_(media_log), |
current_config_index_(0), |
append_config_index_(0), |
seek_pending_(false), |
@@ -114,15 +114,19 @@ SourceBufferStream::SourceBufferStream(const AudioDecoderConfig& audio_config, |
config_change_pending_(false), |
splice_buffers_index_(0), |
pending_buffers_complete_(false), |
- splice_frames_enabled_(splice_frames_enabled) { |
+ splice_frames_enabled_(splice_frames_enabled), |
+ audio_splice_count_(0), |
wolenetz
2015/07/13 22:25:29
Ditto oops, here and below! (PS2 fixes this CL to
|
+ total_audio_splice_duration_(0.0), |
+ min_audio_splice_duration_(0.0), |
+ max_audio_splice_duration_(0.0) { |
DCHECK(audio_config.IsValidConfig()); |
audio_configs_.push_back(audio_config); |
} |
SourceBufferStream::SourceBufferStream(const VideoDecoderConfig& video_config, |
- const LogCB& log_cb, |
+ const scoped_refptr<MediaLog>& media_log, |
bool splice_frames_enabled) |
- : log_cb_(log_cb), |
+ : media_log_(media_log), |
current_config_index_(0), |
append_config_index_(0), |
seek_pending_(false), |
@@ -140,15 +144,19 @@ SourceBufferStream::SourceBufferStream(const VideoDecoderConfig& video_config, |
config_change_pending_(false), |
splice_buffers_index_(0), |
pending_buffers_complete_(false), |
- splice_frames_enabled_(splice_frames_enabled) { |
+ splice_frames_enabled_(splice_frames_enabled), |
+ audio_splice_count_(0), |
+ total_audio_splice_duration_(0.0), |
+ min_audio_splice_duration_(0.0), |
+ max_audio_splice_duration_(0.0) { |
DCHECK(video_config.IsValidConfig()); |
video_configs_.push_back(video_config); |
} |
SourceBufferStream::SourceBufferStream(const TextTrackConfig& text_config, |
- const LogCB& log_cb, |
+ const scoped_refptr<MediaLog>& media_log, |
bool splice_frames_enabled) |
- : log_cb_(log_cb), |
+ : media_log_(media_log), |
current_config_index_(0), |
append_config_index_(0), |
text_track_config_(text_config), |
@@ -167,7 +175,11 @@ SourceBufferStream::SourceBufferStream(const TextTrackConfig& text_config, |
config_change_pending_(false), |
splice_buffers_index_(0), |
pending_buffers_complete_(false), |
- splice_frames_enabled_(splice_frames_enabled) { |
+ splice_frames_enabled_(splice_frames_enabled), |
+ audio_splice_count_(0), |
+ total_audio_splice_duration_(0.0), |
+ min_audio_splice_duration_(0.0), |
+ max_audio_splice_duration_(0.0) { |
} |
SourceBufferStream::~SourceBufferStream() { |
@@ -223,7 +235,8 @@ bool SourceBufferStream::Append(const BufferQueue& buffers) { |
// New media segments must begin with a keyframe. |
// TODO(wolenetz): Relax this requirement. See http://crbug.com/229412. |
if (new_media_segment_ && !buffers.front()->is_key_frame()) { |
- MEDIA_LOG(ERROR, log_cb_) << "Media segment did not begin with key frame."; |
+ MEDIA_LOG(ERROR, media_log_) |
+ << "Media segment did not begin with key frame."; |
return false; |
} |
@@ -233,7 +246,7 @@ bool SourceBufferStream::Append(const BufferQueue& buffers) { |
if (media_segment_start_time_ < DecodeTimestamp() || |
buffers.front()->GetDecodeTimestamp() < DecodeTimestamp()) { |
- MEDIA_LOG(ERROR, log_cb_) |
+ MEDIA_LOG(ERROR, media_log_) |
<< "Cannot append a media segment with negative timestamps."; |
return false; |
} |
@@ -241,8 +254,9 @@ bool SourceBufferStream::Append(const BufferQueue& buffers) { |
if (!IsNextTimestampValid(buffers.front()->GetDecodeTimestamp(), |
buffers.front()->is_key_frame())) { |
const DecodeTimestamp& dts = buffers.front()->GetDecodeTimestamp(); |
- MEDIA_LOG(ERROR, log_cb_) << "Invalid same timestamp construct detected at" |
- << " time " << dts.InSecondsF(); |
+ MEDIA_LOG(ERROR, media_log_) |
+ << "Invalid same timestamp construct detected at" |
+ << " time " << dts.InSecondsF(); |
return false; |
} |
@@ -530,16 +544,17 @@ bool SourceBufferStream::IsMonotonicallyIncreasing( |
if (prev_timestamp != kNoDecodeTimestamp()) { |
if (current_timestamp < prev_timestamp) { |
- MEDIA_LOG(ERROR, log_cb_) << "Buffers did not monotonically increase."; |
+ MEDIA_LOG(ERROR, media_log_) |
+ << "Buffers did not monotonically increase."; |
return false; |
} |
if (current_timestamp == prev_timestamp && |
!SourceBufferRange::AllowSameTimestamp(prev_is_keyframe, |
current_is_keyframe)) { |
- MEDIA_LOG(ERROR, log_cb_) << "Unexpected combination of buffers with" |
- << " the same timestamp detected at " |
- << current_timestamp.InSecondsF(); |
+ MEDIA_LOG(ERROR, media_log_) << "Unexpected combination of buffers with" |
+ << " the same timestamp detected at " |
+ << current_timestamp.InSecondsF(); |
return false; |
} |
} |
@@ -1266,12 +1281,12 @@ bool SourceBufferStream::UpdateAudioConfig(const AudioDecoderConfig& config) { |
DVLOG(3) << "UpdateAudioConfig."; |
if (audio_configs_[0].codec() != config.codec()) { |
- MEDIA_LOG(ERROR, log_cb_) << "Audio codec changes not allowed."; |
+ MEDIA_LOG(ERROR, media_log_) << "Audio codec changes not allowed."; |
return false; |
} |
if (audio_configs_[0].is_encrypted() != config.is_encrypted()) { |
- MEDIA_LOG(ERROR, log_cb_) << "Audio encryption changes not allowed."; |
+ MEDIA_LOG(ERROR, media_log_) << "Audio encryption changes not allowed."; |
return false; |
} |
@@ -1297,12 +1312,12 @@ bool SourceBufferStream::UpdateVideoConfig(const VideoDecoderConfig& config) { |
DVLOG(3) << "UpdateVideoConfig."; |
if (video_configs_[0].codec() != config.codec()) { |
- MEDIA_LOG(ERROR, log_cb_) << "Video codec changes not allowed."; |
+ MEDIA_LOG(ERROR, media_log_) << "Video codec changes not allowed."; |
return false; |
} |
if (video_configs_[0].is_encrypted() != config.is_encrypted()) { |
- MEDIA_LOG(ERROR, log_cb_) << "Video encryption changes not allowed."; |
+ MEDIA_LOG(ERROR, media_log_) << "Video encryption changes not allowed."; |
return false; |
} |