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

Unified Diff: media/formats/mp4/offset_byte_queue.cc

Issue 153103003: Move offset_byte_queue.* from media/mp4 to media/common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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/formats/mp4/offset_byte_queue.h ('k') | media/formats/mp4/offset_byte_queue_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp4/offset_byte_queue.cc
diff --git a/media/formats/mp4/offset_byte_queue.cc b/media/formats/mp4/offset_byte_queue.cc
deleted file mode 100644
index a23a634efd78fa3f8fb1b352c1f7d32c9dd3da13..0000000000000000000000000000000000000000
--- a/media/formats/mp4/offset_byte_queue.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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/formats/mp4/offset_byte_queue.h"
-
-#include "base/basictypes.h"
-#include "base/logging.h"
-
-namespace media {
-
-OffsetByteQueue::OffsetByteQueue() : buf_(NULL), size_(0), head_(0) {}
-OffsetByteQueue::~OffsetByteQueue() {}
-
-void OffsetByteQueue::Reset() {
- queue_.Reset();
- buf_ = NULL;
- size_ = 0;
- head_ = 0;
-}
-
-void OffsetByteQueue::Push(const uint8* buf, int size) {
- queue_.Push(buf, size);
- Sync();
- DVLOG(4) << "Buffer pushed. head=" << head() << " tail=" << tail();
-}
-
-void OffsetByteQueue::Peek(const uint8** buf, int* size) {
- *buf = size_ > 0 ? buf_ : NULL;
- *size = size_;
-}
-
-void OffsetByteQueue::Pop(int count) {
- queue_.Pop(count);
- head_ += count;
- Sync();
-}
-
-void OffsetByteQueue::PeekAt(int64 offset, const uint8** buf, int* size) {
- DCHECK(offset >= head());
- if (offset < head() || offset >= tail()) {
- *buf = NULL;
- *size = 0;
- return;
- }
- *buf = &buf_[offset - head()];
- *size = tail() - offset;
-}
-
-bool OffsetByteQueue::Trim(int64 max_offset) {
- if (max_offset < head_) return true;
- if (max_offset > tail()) {
- Pop(size_);
- return false;
- }
- Pop(max_offset - head_);
- return true;
-}
-
-void OffsetByteQueue::Sync() {
- queue_.Peek(&buf_, &size_);
-}
-
-} // namespace media
« no previous file with comments | « media/formats/mp4/offset_byte_queue.h ('k') | media/formats/mp4/offset_byte_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698