Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Unified Diff: media/filters/chunk_demuxer.cc

Issue 256583006: Fix possible buffer emission during an abort. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CR comments. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/chunk_demuxer.cc
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index 0c5608943725b41383b8aa278b056c792dbecf60..213883fa91243253e53f35a1249a40f00dd1b606 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -124,12 +124,14 @@ class SourceState {
// spec's similarly named source buffer attributes that are used in coded
// frame processing.
bool Append(const uint8* data, size_t length,
- TimeDelta append_window_start_,
- TimeDelta append_window_end_,
+ TimeDelta append_window_start,
+ TimeDelta append_window_end,
TimeDelta* timestamp_offset);
// Aborts the current append sequence and resets the parser.
- void Abort();
+ void Abort(TimeDelta append_window_start,
+ TimeDelta append_window_end,
+ TimeDelta* timestamp_offset);
// Calls Remove(|start|, |end|, |duration|) on all
// ChunkDemuxerStreams managed by this object.
@@ -314,8 +316,18 @@ bool SourceState::Append(const uint8* data, size_t length,
return err;
}
-void SourceState::Abort() {
+void SourceState::Abort(TimeDelta append_window_start,
+ TimeDelta append_window_end,
+ base::TimeDelta* timestamp_offset) {
+ DCHECK(timestamp_offset);
+ DCHECK(!timestamp_offset_during_append_);
+ timestamp_offset_during_append_ = timestamp_offset;
+ append_window_start_during_append_ = append_window_start;
+ append_window_end_during_append_ = append_window_end;
+
stream_parser_->Flush();
+ timestamp_offset_during_append_ = NULL;
+
frame_processor_->Reset();
parsing_media_segment_ = false;
}
@@ -661,6 +673,7 @@ bool SourceState::OnNewBuffers(
const StreamParser::TextBufferQueueMap& text_map) {
DVLOG(2) << "OnNewBuffers()";
DCHECK(timestamp_offset_during_append_);
+ DCHECK(parsing_media_segment_);
const TimeDelta timestamp_offset_before_processing =
*timestamp_offset_during_append_;
@@ -1275,12 +1288,17 @@ void ChunkDemuxer::AppendData(const std::string& id,
host_->AddBufferedTimeRange(ranges.start(i), ranges.end(i));
}
-void ChunkDemuxer::Abort(const std::string& id) {
+void ChunkDemuxer::Abort(const std::string& id,
+ TimeDelta append_window_start,
+ TimeDelta append_window_end,
+ TimeDelta* timestamp_offset) {
DVLOG(1) << "Abort(" << id << ")";
base::AutoLock auto_lock(lock_);
DCHECK(!id.empty());
CHECK(IsValidId(id));
- source_state_map_[id]->Abort();
+ source_state_map_[id]->Abort(append_window_start,
+ append_window_end,
+ timestamp_offset);
}
void ChunkDemuxer::Remove(const std::string& id, TimeDelta start,
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698