OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_ | 5 #ifndef PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_ |
6 #define PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_ | 6 #define PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... | |
31 // 6. When the frame from the step 5 is consumed, the reader sends the frame | 31 // 6. When the frame from the step 5 is consumed, the reader sends the frame |
32 // index back to writer via an IPC message. | 32 // index back to writer via an IPC message. |
33 // 7. The writer receives the frame index and puts it back to the writer's free | 33 // 7. The writer receives the frame index and puts it back to the writer's free |
34 // frame queue by calling the writer's |frame_buffer_.Enqueue()|. | 34 // frame queue by calling the writer's |frame_buffer_.Enqueue()|. |
35 // 8. Go back to step 1. | 35 // 8. Go back to step 1. |
36 class PPAPI_SHARED_EXPORT MediaStreamFrameBuffer { | 36 class PPAPI_SHARED_EXPORT MediaStreamFrameBuffer { |
37 public: | 37 public: |
38 class PPAPI_SHARED_EXPORT Delegate { | 38 class PPAPI_SHARED_EXPORT Delegate { |
39 public: | 39 public: |
40 virtual ~Delegate(); | 40 virtual ~Delegate(); |
41 // It is called when a new frame is enqueued. | 41 // It is called before a new frame being enqueued. Return true if the frame |
42 virtual void OnNewFrameEnqueued(); | 42 // is consumed by |Delegate|, and then the frame will not be added into the |
43 // |frame_queue_|. | |
44 virtual bool OnNewFramePreEnqueued(int32_t index); | |
yzshen1
2014/01/29 21:28:06
BeforeNewFrameEnqueued() may be more clearer.
Tha
Peng
2014/01/31 18:54:43
I though the performance is slightly better by avo
| |
43 }; | 45 }; |
44 | 46 |
45 // MediaStreamFrameBuffer doesn't own |delegate|, the caller should keep | 47 // MediaStreamFrameBuffer doesn't own |delegate|, the caller should keep |
46 // it alive during the MediaStreamFrameBuffer's lifecycle. | 48 // it alive during the MediaStreamFrameBuffer's lifecycle. |
47 explicit MediaStreamFrameBuffer(Delegate* delegate); | 49 explicit MediaStreamFrameBuffer(Delegate* delegate); |
48 | 50 |
49 ~MediaStreamFrameBuffer(); | 51 ~MediaStreamFrameBuffer(); |
50 | 52 |
51 int32_t number_of_frames() const { return number_of_frames_; } | 53 int32_t number_of_frames() const { return number_of_frames_; } |
52 | 54 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 | 86 |
85 // A memory block shared between renderer process and plugin process. | 87 // A memory block shared between renderer process and plugin process. |
86 scoped_ptr<base::SharedMemory> shm_; | 88 scoped_ptr<base::SharedMemory> shm_; |
87 | 89 |
88 DISALLOW_COPY_AND_ASSIGN(MediaStreamFrameBuffer); | 90 DISALLOW_COPY_AND_ASSIGN(MediaStreamFrameBuffer); |
89 }; | 91 }; |
90 | 92 |
91 } // namespace ppapi | 93 } // namespace ppapi |
92 | 94 |
93 #endif // PPAPI_SHAERD_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_ | 95 #endif // PPAPI_SHAERD_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_ |
OLD | NEW |