Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_TRACK_HOST_BASE_H_ | |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_TRACK_HOST_BASE_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "content/common/content_export.h" | |
| 10 #include "ppapi/host/resource_host.h" | |
| 11 #include "ppapi/shared_impl/media_stream_frame_buffer.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 class RendererPpapiHost; | |
| 16 | |
| 17 class PepperMediaStreamTrackHostBase | |
| 18 : public ppapi::host::ResourceHost, | |
| 19 public ppapi::MediaStreamFrameBuffer::Delegate { | |
| 20 protected: | |
| 21 PepperMediaStreamTrackHostBase(RendererPpapiHost* host, | |
| 22 PP_Instance instance, | |
| 23 PP_Resource resource); | |
| 24 virtual ~PepperMediaStreamTrackHostBase(); | |
| 25 | |
| 26 bool InitFrames(int32_t number_of_frames, int32_t frame_size); | |
| 27 | |
| 28 ppapi::MediaStreamFrameBuffer* frame_buffer() { return &frame_buffer_; } | |
| 29 | |
| 30 // Sends a frame index to a paired MediaStreamTrackResourceBase via an IPC | |
| 31 // message, and then the resource will add the frame index into its | |
| 32 // |frame_buffer_| for reading or writing. Also see |MediaStreamFrameBuffer|. | |
|
bbudge
2014/01/10 22:57:06
Consider:
// Sends a frame index to the correspond
Peng
2014/01/13 19:10:15
Done.
| |
| 33 void PluginEnqueueFrame(int32_t index); | |
|
bbudge
2014/01/10 22:57:06
Consider renaming this to SendEnqueueFrameMessageT
Peng
2014/01/13 19:10:15
Done.
| |
| 34 | |
| 35 // Subclass should implement this method to get notification when the track is | |
| 36 // being closed. | |
|
bbudge
2014/01/10 22:57:06
Consider:
// Subclasses must implement this method
Peng
2014/01/13 19:10:15
Done.
| |
| 37 virtual void OnClose() = 0; | |
| 38 | |
| 39 private: | |
| 40 // ResourceMessageHandler overrides: | |
| 41 virtual int32_t OnResourceMessageReceived( | |
| 42 const IPC::Message& msg, | |
| 43 ppapi::host::HostMessageContext* context) OVERRIDE; | |
| 44 | |
| 45 // Message handlers: | |
| 46 int32_t OnHostMsgEnqueueFrame(ppapi::host::HostMessageContext* context, | |
| 47 int32_t index); | |
| 48 int32_t OnHostMsgClose(ppapi::host::HostMessageContext* context); | |
| 49 | |
| 50 RendererPpapiHost* host_; | |
| 51 | |
| 52 ppapi::MediaStreamFrameBuffer frame_buffer_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(PepperMediaStreamTrackHostBase); | |
| 55 }; | |
| 56 | |
| 57 } // namespace content | |
| 58 | |
| 59 #endif // CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_TRACK_HOST_BASE_H_ | |
| OLD | NEW |