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

Unified Diff: media/filters/frame_processor_base.cc

Issue 191513002: Extract coded frame processing from SourceState into LegacyFrameProcessor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some lint errors Created 6 years, 9 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
Index: media/filters/frame_processor_base.cc
diff --git a/media/filters/frame_processor_base.cc b/media/filters/frame_processor_base.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a4d23819d2c52ba70accbbf3c438b45fe60384ec
--- /dev/null
+++ b/media/filters/frame_processor_base.cc
@@ -0,0 +1,72 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/filters/frame_processor_base.h"
+
+#include "base/stl_util.h"
+#include "media/base/buffers.h"
+
+namespace media {
+
+TrackBufferAppendState::TrackBufferAppendState(
+ ChunkDemuxerStream* stream)
+ : needs_random_access_point_(true),
+ stream_(stream) {
+ DCHECK(stream_);
+}
+
+TrackBufferAppendState::~TrackBufferAppendState() {
+ DVLOG(2) << __FUNCTION__ << "()";
+}
+
+void TrackBufferAppendState::Reset() {
+ DVLOG(2) << __FUNCTION__ << "()";
+
+ needs_random_access_point_ = true;
+}
+
+FrameProcessorBase::FrameProcessorBase(
+ const IncreaseDurationCB& increase_duration_cb)
+ : sequence_mode_(false),
+ append_window_end_(kInfiniteDuration()),
+ increase_duration_cb_(increase_duration_cb) {
+ DCHECK(!increase_duration_cb_.is_null());
+}
+
+FrameProcessorBase::~FrameProcessorBase() {
+ DVLOG(2) << __FUNCTION__ << "()";
+
+ STLDeleteValues(&tracks_);
+}
+
+bool FrameProcessorBase::AddTrack(StreamParser::TrackId id,
+ ChunkDemuxerStream* stream) {
+ DVLOG(2) << __FUNCTION__ << "(): id=" << id;
+
+ if (FindTrack(id)) {
+ DVLOG(2) << "Matching track was previously added, id=" << id;
+ return false;
+ }
+
+ tracks_[id] = new TrackBufferAppendState(stream);
+ return true;
+}
+
+void FrameProcessorBase::Reset() {
+ DVLOG(2) << __FUNCTION__ << "()";
+ for (TrackMap::iterator itr = tracks_.begin(); itr != tracks_.end(); ++itr) {
+ itr->second->Reset();
+ }
+}
+
+TrackBufferAppendState* FrameProcessorBase::FindTrack(
+ StreamParser::TrackId id) {
+ TrackMap::iterator itr = tracks_.find(id);
+ if (itr == tracks_.end())
+ return NULL;
+
+ return itr->second;
+}
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698