| Index: ppapi/shared_impl/media_stream_track_base_shared.h
|
| diff --git a/ppapi/shared_impl/media_stream_track_base_shared.h b/ppapi/shared_impl/media_stream_track_base_shared.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bddd3adc37b73f34411545eec71ae1caf6c0d3cc
|
| --- /dev/null
|
| +++ b/ppapi/shared_impl/media_stream_track_base_shared.h
|
| @@ -0,0 +1,71 @@
|
| +// Copyright (c) 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.
|
| +
|
| +#ifndef PPAPI_SHARED_IMPL_MEDIA_STREAM_TRACK_BASE_SHARED_H_
|
| +#define PPAPI_SHARED_IMPL_MEDIA_STREAM_TRACK_BASE_SHARED_H_
|
| +
|
| +#include <deque>
|
| +#include <vector>
|
| +
|
| +#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 {
|
| +
|
| +class PPAPI_SHARED_EXPORT MediaStreamTrackBaseShared {
|
| + protected:
|
| + MediaStreamTrackBaseShared();
|
| +
|
| + virtual ~MediaStreamTrackBaseShared();
|
| +
|
| + int32_t number_of_frames() const { return number_of_frames_; }
|
| +
|
| + int32_t frame_size() const { return frame_size_; }
|
| +
|
| + // Initializes shared memory for frames transmission.
|
| + bool SetFrames(int32_t number_of_frames,
|
| + int32_t frame_size,
|
| + scoped_ptr<base::SharedMemory> shm);
|
| +
|
| + // Dequeues a frame from |frame_queue_|.
|
| + int32_t DequeueFrame();
|
| +
|
| + // Puts a frame into |frame_queue_|.
|
| + void EnqueueFrame(int32_t index);
|
| +
|
| + // Gets a frame address for the given index.
|
| + MediaStreamFrame* GetFramePointer(int32_t index);
|
| +
|
| + // Subclass should implement this method to get notification when a new frame
|
| + // is enqueued.
|
| + virtual void OnNewFrameEnqueued();
|
| +
|
| + private:
|
| + // A queue of incoming frame indexes.
|
| + // For the input side, they are empty frames which will be filled with data
|
| + // and sent to the output side.
|
| + // For the output side, they are received frames waiting for consuming.
|
| + std::deque<int32_t> frame_queue_;
|
| +
|
| + // A vector of frame pointers. It is used for index to pointer converting.
|
| + std::vector<MediaStreamFrame*> frames_;
|
| +
|
| + // The frame size in bytes.
|
| + int32_t frame_size_;
|
| +
|
| + // The number of frames in the shared memory.
|
| + int32_t number_of_frames_;
|
| +
|
| + // A memory block shared between renderer and plugin processes.
|
| + scoped_ptr<base::SharedMemory> shm_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(MediaStreamTrackBaseShared);
|
| +};
|
| +
|
| +} // namespace ppapi
|
| +
|
| +#endif // PPAPI_SHAERD_IMPL_MEDIA_STREAM_TRACK_BASE_SHARED_H_
|
|
|