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

Unified Diff: ppapi/shared_impl/media_stream_buffer_manager.h

Issue 142023008: [PPAPI][MediaStream] Rename AudioFrame to AudioBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix review issues Created 6 years, 10 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 | « ppapi/shared_impl/media_stream_buffer.h ('k') | ppapi/shared_impl/media_stream_buffer_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/media_stream_buffer_manager.h
diff --git a/ppapi/shared_impl/media_stream_frame_buffer.h b/ppapi/shared_impl/media_stream_buffer_manager.h
similarity index 28%
rename from ppapi/shared_impl/media_stream_frame_buffer.h
rename to ppapi/shared_impl/media_stream_buffer_manager.h
index e95084642c03bc20a2ae32b452df4f0a88ca8c4d..b59d02714762bebe4651804837c791873858a3a3 100644
--- a/ppapi/shared_impl/media_stream_frame_buffer.h
+++ b/ppapi/shared_impl/media_stream_buffer_manager.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_
-#define PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_
+#ifndef PPAPI_SHARED_IMPL_MEDIA_STREAM_BUFFER_MANAGER_H_
+#define PPAPI_SHARED_IMPL_MEDIA_STREAM_BUFFER_MANAGER_H_
#include <deque>
#include <vector>
@@ -11,83 +11,84 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
-#include "ppapi/shared_impl/media_stream_frame.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
namespace ppapi {
+union MediaStreamBuffer;
+
// This class is used by both read side and write side of a MediaStreamTrack to
-// maintain a queue of frames for reading or writing.
+// maintain a queue of buffers for reading or writing.
//
// An example:
-// 1. The writer calls the writer's |frame_buffer_.Dequeue()| to get a free
-// frame.
-// 2. The writer fills data into the frame.
-// 3. The writer sends the frame index to the reader via an IPC message.
-// 4. The reader receives the frame index and calls the reader's
-// |frame_buffer.Enqueue()| to put the frame into the read's queue.
-// 5. The reader calls reader's |frame_buffer_.Dequeue()| to get a received
-// frame.
-// 6. When the frame from the step 5 is consumed, the reader sends the frame
+// 1. The writer calls the writer's |buffer_manager_.Dequeue()| to get a free
+// buffer.
+// 2. The writer fills data into the buffer.
+// 3. The writer sends the buffer index to the reader via an IPC message.
+// 4. The reader receives the buffer index and calls the reader's
+// |buffer_buffer.Enqueue()| to put the buffer into the read's queue.
+// 5. The reader calls reader's |buffer_buffer_.Dequeue()| to get a received
+// buffer.
+// 6. When the buffer from the step 5 is consumed, the reader sends the buffer
// index back to writer via an IPC message.
-// 7. The writer receives the frame index and puts it back to the writer's free
-// frame queue by calling the writer's |frame_buffer_.Enqueue()|.
+// 7. The writer receives the buffer index and puts it back to the writer's
+// free buffer queue by calling the writer's |buffer_manager_.Enqueue()|.
// 8. Go back to step 1.
-class PPAPI_SHARED_EXPORT MediaStreamFrameBuffer {
+class PPAPI_SHARED_EXPORT MediaStreamBufferManager {
public:
class PPAPI_SHARED_EXPORT Delegate {
public:
virtual ~Delegate();
- // It is called when a new frame is enqueued.
- virtual void OnNewFrameEnqueued();
+ // It is called when a new buffer is enqueued.
+ virtual void OnNewBufferEnqueued();
};
- // MediaStreamFrameBuffer doesn't own |delegate|, the caller should keep
- // it alive during the MediaStreamFrameBuffer's lifecycle.
- explicit MediaStreamFrameBuffer(Delegate* delegate);
+ // MediaStreamBufferManager doesn't own |delegate|, the caller should keep
+ // it alive during the MediaStreamBufferManager's lifecycle.
+ explicit MediaStreamBufferManager(Delegate* delegate);
- ~MediaStreamFrameBuffer();
+ ~MediaStreamBufferManager();
- int32_t number_of_frames() const { return number_of_frames_; }
+ int32_t number_of_buffers() const { return number_of_buffers_; }
- int32_t frame_size() const { return frame_size_; }
+ int32_t buffer_size() const { return buffer_size_; }
- // Initializes shared memory for frames transmission.
- bool SetFrames(int32_t number_of_frames,
- int32_t frame_size,
+ // Initializes shared memory for buffers transmission.
+ bool SetBuffers(int32_t number_of_buffers,
+ int32_t buffer_size,
scoped_ptr<base::SharedMemory> shm,
- bool enqueue_all_frames);
+ bool enqueue_all_buffers);
- // Dequeues a frame from |frame_queue_|.
- int32_t DequeueFrame();
+ // Dequeues a buffer from |buffer_queue_|.
+ int32_t DequeueBuffer();
- // Puts a frame into |frame_queue_|.
- void EnqueueFrame(int32_t index);
+ // Puts a buffer into |buffer_queue_|.
+ void EnqueueBuffer(int32_t index);
- // Gets the frame address for the given frame index.
- MediaStreamFrame* GetFramePointer(int32_t index);
+ // Gets the buffer address for the given buffer index.
+ MediaStreamBuffer* GetBufferPointer(int32_t index);
private:
Delegate* delegate_;
- // A queue of frame indexes.
- std::deque<int32_t> frame_queue_;
+ // A queue of buffer indices.
+ std::deque<int32_t> buffer_queue_;
- // A vector of frame pointers. It is used for index to pointer converting.
- std::vector<MediaStreamFrame*> frames_;
+ // A vector of buffer pointers. It is used for index to pointer converting.
+ std::vector<MediaStreamBuffer*> buffers_;
- // The frame size in bytes.
- int32_t frame_size_;
+ // The buffer size in bytes.
+ int32_t buffer_size_;
- // The number of frames in the shared memory.
- int32_t number_of_frames_;
+ // The number of buffers in the shared memory.
+ int32_t number_of_buffers_;
// A memory block shared between renderer process and plugin process.
scoped_ptr<base::SharedMemory> shm_;
- DISALLOW_COPY_AND_ASSIGN(MediaStreamFrameBuffer);
+ DISALLOW_COPY_AND_ASSIGN(MediaStreamBufferManager);
};
} // namespace ppapi
-#endif // PPAPI_SHAERD_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_
+#endif // PPAPI_SHAERD_IMPL_MEDIA_STREAM_BUFFER_MANAGER_H_
« no previous file with comments | « ppapi/shared_impl/media_stream_buffer.h ('k') | ppapi/shared_impl/media_stream_buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698