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

Side by Side Diff: media/filters/chunk_demuxer.cc

Issue 1312763014: Rename WebSourceBuffer::abort -> resetParserState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/chunk_demuxer.h" 5 #include "media/filters/chunk_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <list> 9 #include <list>
10 10
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // frame processing. |init_segment_received_cb| is run for each new fully 119 // frame processing. |init_segment_received_cb| is run for each new fully
120 // parsed initialization segment. 120 // parsed initialization segment.
121 bool Append(const uint8* data, 121 bool Append(const uint8* data,
122 size_t length, 122 size_t length,
123 TimeDelta append_window_start, 123 TimeDelta append_window_start,
124 TimeDelta append_window_end, 124 TimeDelta append_window_end,
125 TimeDelta* timestamp_offset, 125 TimeDelta* timestamp_offset,
126 const InitSegmentReceivedCB& init_segment_received_cb); 126 const InitSegmentReceivedCB& init_segment_received_cb);
127 127
128 // Aborts the current append sequence and resets the parser. 128 // Aborts the current append sequence and resets the parser.
129 void Abort(TimeDelta append_window_start, 129 void ResetParserState(TimeDelta append_window_start,
130 TimeDelta append_window_end, 130 TimeDelta append_window_end,
131 TimeDelta* timestamp_offset); 131 TimeDelta* timestamp_offset);
132 132
133 // Calls Remove(|start|, |end|, |duration|) on all 133 // Calls Remove(|start|, |end|, |duration|) on all
134 // ChunkDemuxerStreams managed by this object. 134 // ChunkDemuxerStreams managed by this object.
135 void Remove(TimeDelta start, TimeDelta end, TimeDelta duration); 135 void Remove(TimeDelta start, TimeDelta end, TimeDelta duration);
136 136
137 // If the buffer is full, attempts to try to free up space, as specified in 137 // If the buffer is full, attempts to try to free up space, as specified in
138 // the "Coded Frame Eviction Algorithm" in the Media Source Extensions Spec. 138 // the "Coded Frame Eviction Algorithm" in the Media Source Extensions Spec.
139 // Returns false iff buffer is still full after running eviction. 139 // Returns false iff buffer is still full after running eviction.
140 // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction 140 // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction
141 bool EvictCodedFrames(DecodeTimestamp media_time, size_t newDataSize); 141 bool EvictCodedFrames(DecodeTimestamp media_time, size_t newDataSize);
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 << __FUNCTION__ << ": stream parsing failed." 348 << __FUNCTION__ << ": stream parsing failed."
349 << " Data size=" << length 349 << " Data size=" << length
350 << " append_window_start=" << append_window_start.InSecondsF() 350 << " append_window_start=" << append_window_start.InSecondsF()
351 << " append_window_end=" << append_window_end.InSecondsF(); 351 << " append_window_end=" << append_window_end.InSecondsF();
352 } 352 }
353 timestamp_offset_during_append_ = NULL; 353 timestamp_offset_during_append_ = NULL;
354 init_segment_received_cb_.Reset(); 354 init_segment_received_cb_.Reset();
355 return result; 355 return result;
356 } 356 }
357 357
358 void SourceState::Abort(TimeDelta append_window_start, 358 void SourceState::ResetParserState(TimeDelta append_window_start,
359 TimeDelta append_window_end, 359 TimeDelta append_window_end,
360 base::TimeDelta* timestamp_offset) { 360 base::TimeDelta* timestamp_offset) {
361 DCHECK(timestamp_offset); 361 DCHECK(timestamp_offset);
362 DCHECK(!timestamp_offset_during_append_); 362 DCHECK(!timestamp_offset_during_append_);
363 timestamp_offset_during_append_ = timestamp_offset; 363 timestamp_offset_during_append_ = timestamp_offset;
364 append_window_start_during_append_ = append_window_start; 364 append_window_start_during_append_ = append_window_start;
365 append_window_end_during_append_ = append_window_end; 365 append_window_end_during_append_ = append_window_end;
366 366
367 stream_parser_->Flush(); 367 stream_parser_->Flush();
368 timestamp_offset_during_append_ = NULL; 368 timestamp_offset_during_append_ = NULL;
369 369
370 frame_processor_->Reset(); 370 frame_processor_->Reset();
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 base::ResetAndReturn(&seek_cb_).Run(PIPELINE_OK); 1506 base::ResetAndReturn(&seek_cb_).Run(PIPELINE_OK);
1507 } 1507 }
1508 1508
1509 ranges = GetBufferedRanges_Locked(); 1509 ranges = GetBufferedRanges_Locked();
1510 } 1510 }
1511 1511
1512 for (size_t i = 0; i < ranges.size(); ++i) 1512 for (size_t i = 0; i < ranges.size(); ++i)
1513 host_->AddBufferedTimeRange(ranges.start(i), ranges.end(i)); 1513 host_->AddBufferedTimeRange(ranges.start(i), ranges.end(i));
1514 } 1514 }
1515 1515
1516 void ChunkDemuxer::Abort(const std::string& id, 1516 void ChunkDemuxer::ResetParserState(const std::string& id,
1517 TimeDelta append_window_start, 1517 TimeDelta append_window_start,
1518 TimeDelta append_window_end, 1518 TimeDelta append_window_end,
1519 TimeDelta* timestamp_offset) { 1519 TimeDelta* timestamp_offset) {
1520 DVLOG(1) << "Abort(" << id << ")"; 1520 DVLOG(1) << "ResetParserState(" << id << ")";
1521 base::AutoLock auto_lock(lock_); 1521 base::AutoLock auto_lock(lock_);
1522 DCHECK(!id.empty()); 1522 DCHECK(!id.empty());
1523 CHECK(IsValidId(id)); 1523 CHECK(IsValidId(id));
1524 bool old_waiting_for_data = IsSeekWaitingForData_Locked(); 1524 bool old_waiting_for_data = IsSeekWaitingForData_Locked();
1525 source_state_map_[id]->Abort(append_window_start, 1525 source_state_map_[id]->ResetParserState(append_window_start,
1526 append_window_end, 1526 append_window_end,
1527 timestamp_offset); 1527 timestamp_offset);
1528 // Abort can possibly emit some buffers. 1528 // ResetParserState can possibly emit some buffers.
1529 // Need to check whether seeking can be completed. 1529 // Need to check whether seeking can be completed.
1530 if (old_waiting_for_data && !IsSeekWaitingForData_Locked() && 1530 if (old_waiting_for_data && !IsSeekWaitingForData_Locked() &&
1531 !seek_cb_.is_null()) { 1531 !seek_cb_.is_null()) {
1532 base::ResetAndReturn(&seek_cb_).Run(PIPELINE_OK); 1532 base::ResetAndReturn(&seek_cb_).Run(PIPELINE_OK);
1533 } 1533 }
1534 } 1534 }
1535 1535
1536 void ChunkDemuxer::Remove(const std::string& id, TimeDelta start, 1536 void ChunkDemuxer::Remove(const std::string& id, TimeDelta start,
1537 TimeDelta end) { 1537 TimeDelta end) {
1538 DVLOG(1) << "Remove(" << id << ", " << start.InSecondsF() 1538 DVLOG(1) << "Remove(" << id << ", " << start.InSecondsF()
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 } 1958 }
1959 1959
1960 void ChunkDemuxer::ShutdownAllStreams() { 1960 void ChunkDemuxer::ShutdownAllStreams() {
1961 for (SourceStateMap::iterator itr = source_state_map_.begin(); 1961 for (SourceStateMap::iterator itr = source_state_map_.begin();
1962 itr != source_state_map_.end(); ++itr) { 1962 itr != source_state_map_.end(); ++itr) {
1963 itr->second->Shutdown(); 1963 itr->second->Shutdown();
1964 } 1964 }
1965 } 1965 }
1966 1966
1967 } // namespace media 1967 } // namespace media
OLDNEW
« 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