Bug 1041346 - Remove MediaBufferGroup from libstagefright, since it's no longer used. r=kentuckyfriedtakahe
authorChris Pearce <cpearce@mozilla.com>
Mon, 21 Jul 2014 14:00:42 +1200
changeset 217156 463dfcb4901a3c575bf9f5e1efc43db35a2e9216
parent 217155 771dea9531b4e23a5c36d550e190a3362f9b0045
child 217157 30364f5f934bc915cb8adee2a81ab99cebc8c1ba
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskentuckyfriedtakahe
bugs1041346
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1041346 - Remove MediaBufferGroup from libstagefright, since it's no longer used. r=kentuckyfriedtakahe
media/libstagefright/additional_headers
media/libstagefright/frameworks/av/include/media/stagefright/MediaBuffer.h
media/libstagefright/frameworks/av/include/media/stagefright/MediaBufferGroup.h
media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
media/libstagefright/frameworks/av/media/libstagefright/MediaBufferGroup.cpp
media/libstagefright/moz.build
--- a/media/libstagefright/additional_headers
+++ b/media/libstagefright/additional_headers
@@ -1,17 +1,16 @@
 frameworks/av/include/media/stagefright/foundation/AAtomizer.h
 frameworks/av/include/media/stagefright/foundation/ABase.h
 frameworks/av/include/media/stagefright/foundation/ABitReader.h
 frameworks/av/include/media/stagefright/foundation/ABuffer.h
 frameworks/av/include/media/stagefright/foundation/ADebug.h
 frameworks/av/include/media/stagefright/foundation/AHandler.h
 frameworks/av/include/media/stagefright/foundation/AString.h
 frameworks/av/include/media/stagefright/foundation/hexdump.h
-frameworks/av/include/media/stagefright/MediaBufferGroup.h
 frameworks/av/include/media/stagefright/MediaDefs.h
 frameworks/av/include/media/stagefright/MediaErrors.h
 frameworks/av/include/media/stagefright/MediaExtractor.h
 frameworks/av/include/media/stagefright/MediaSource.h
 frameworks/av/include/media/stagefright/MetaData.h
 frameworks/av/include/media/stagefright/MetaData.h
 frameworks/av/media/libstagefright/include/ESDS.h
 frameworks/av/media/libstagefright/include/ID3.h
--- a/media/libstagefright/frameworks/av/include/media/stagefright/MediaBuffer.h
+++ b/media/libstagefright/frameworks/av/include/media/stagefright/MediaBuffer.h
@@ -49,18 +49,18 @@ public:
     MediaBuffer(void *data, size_t size);
 
     MediaBuffer(size_t size);
 
     MediaBuffer(const sp<GraphicBuffer>& graphicBuffer);
 
     MediaBuffer(const sp<ABuffer> &buffer);
 
-    // Decrements the reference count and returns the buffer to its
-    // associated MediaBufferGroup if the reference count drops to 0.
+    // Decrements the reference count and deletes it if the reference
+    // count drops to 0.
     void release();
 
     // Increments the reference count.
     void add_ref();
 
     void *data() const;
     size_t size() const;
 
deleted file mode 100644
--- a/media/libstagefright/frameworks/av/include/media/stagefright/MediaBufferGroup.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef MEDIA_BUFFER_GROUP_H_
-
-#define MEDIA_BUFFER_GROUP_H_
-
-#include <media/stagefright/MediaBuffer.h>
-#include <utils/Errors.h>
-#include <utils/threads.h>
-
-namespace stagefright {
-
-class MediaBuffer;
-class MetaData;
-
-class MediaBufferGroup : public MediaBufferObserver {
-public:
-    MediaBufferGroup();
-    ~MediaBufferGroup();
-
-    void add_buffer(MediaBuffer *buffer);
-
-    // Blocks until a buffer is available and returns it to the caller,
-    // the returned buffer will have a reference count of 1.
-    status_t acquire_buffer(MediaBuffer **buffer);
-
-protected:
-    virtual void signalBufferReturned(MediaBuffer *buffer);
-
-private:
-    friend class MediaBuffer;
-
-    Mutex mLock;
-    Condition mCondition;
-
-    MediaBuffer *mFirstBuffer, *mLastBuffer;
-
-    MediaBufferGroup(const MediaBufferGroup &);
-    MediaBufferGroup &operator=(const MediaBufferGroup &);
-};
-
-}  // namespace stagefright
-
-#endif  // MEDIA_BUFFER_GROUP_H_
--- a/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp
@@ -28,17 +28,16 @@
 #include <stdlib.h>
 #include <string.h>
 
 #include <media/stagefright/foundation/ABitReader.h>
 #include <media/stagefright/foundation/ABuffer.h>
 #include <media/stagefright/foundation/ADebug.h>
 #include <media/stagefright/foundation/AMessage.h>
 #include <media/stagefright/MediaBuffer.h>
-#include <media/stagefright/MediaBufferGroup.h>
 #include <media/stagefright/MediaDefs.h>
 #include <media/stagefright/MediaSource.h>
 #include <media/stagefright/MetaData.h>
 #include <utils/String8.h>
 
 namespace stagefright {
 
 class MPEG4Source : public MediaSource {
deleted file mode 100644
--- a/media/libstagefright/frameworks/av/media/libstagefright/MediaBufferGroup.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#undef LOG_TAG
-#define LOG_TAG "MediaBufferGroup"
-#include <utils/Log.h>
-
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/MediaBuffer.h>
-#include <media/stagefright/MediaBufferGroup.h>
-
-namespace stagefright {
-
-MediaBufferGroup::MediaBufferGroup()
-    : mFirstBuffer(NULL),
-      mLastBuffer(NULL) {
-}
-
-MediaBufferGroup::~MediaBufferGroup() {
-    MediaBuffer *next;
-    for (MediaBuffer *buffer = mFirstBuffer; buffer != NULL;
-         buffer = next) {
-        next = buffer->nextBuffer();
-
-        CHECK_EQ(buffer->refcount(), 0);
-
-        buffer->setObserver(NULL);
-        buffer->release();
-    }
-}
-
-void MediaBufferGroup::add_buffer(MediaBuffer *buffer) {
-    Mutex::Autolock autoLock(mLock);
-
-    buffer->setObserver(this);
-
-    if (mLastBuffer) {
-        mLastBuffer->setNextBuffer(buffer);
-    } else {
-        mFirstBuffer = buffer;
-    }
-
-    mLastBuffer = buffer;
-}
-
-status_t MediaBufferGroup::acquire_buffer(MediaBuffer **out) {
-    Mutex::Autolock autoLock(mLock);
-
-    for (;;) {
-        for (MediaBuffer *buffer = mFirstBuffer;
-             buffer != NULL; buffer = buffer->nextBuffer()) {
-            if (buffer->refcount() == 0) {
-                buffer->add_ref();
-                buffer->reset();
-
-                *out = buffer;
-                goto exit;
-            }
-        }
-
-        // All buffers are in use. Block until one of them is returned to us.
-        mCondition.wait(mLock);
-    }
-
-exit:
-    return OK;
-}
-
-void MediaBufferGroup::signalBufferReturned(MediaBuffer *) {
-    Mutex::Autolock autoLock(mLock);
-    mCondition.signal();
-}
-
-}  // namespace stagefright
-
-#undef LOG_TAG
--- a/media/libstagefright/moz.build
+++ b/media/libstagefright/moz.build
@@ -70,17 +70,16 @@ UNIFIED_SOURCES += [
     'frameworks/av/media/libstagefright/DataSource.cpp',
     'frameworks/av/media/libstagefright/ESDS.cpp',
     'frameworks/av/media/libstagefright/foundation/AAtomizer.cpp',
     'frameworks/av/media/libstagefright/foundation/ABitReader.cpp',
     'frameworks/av/media/libstagefright/foundation/ABuffer.cpp',
     'frameworks/av/media/libstagefright/foundation/AString.cpp',
     'frameworks/av/media/libstagefright/id3/ID3.cpp',
     'frameworks/av/media/libstagefright/MediaBuffer.cpp',
-    'frameworks/av/media/libstagefright/MediaBufferGroup.cpp',
     'frameworks/av/media/libstagefright/MediaDefs.cpp',
     'frameworks/av/media/libstagefright/MediaSource.cpp',
     'frameworks/av/media/libstagefright/MPEG4Extractor.cpp',
     'frameworks/av/media/libstagefright/SampleIterator.cpp',
     'frameworks/av/media/libstagefright/SampleTable.cpp',
     'frameworks/av/media/libstagefright/Utils.cpp',
     'system/core/libutils/SharedBuffer.cpp',
     'system/core/libutils/Static.cpp',