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

Side by Side Diff: ppapi/proxy/video_frame_resource.cc

Issue 128683003: [PPAPI] Implement media stream video track API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@video_track_impl_cl
Patch Set: Fix review issues Created 6 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ppapi/proxy/video_frame_resource.h"
6
7 #include "ppapi/c/pp_bool.h"
8 #include "ppapi/shared_impl/var.h"
9
10 namespace ppapi {
11 namespace proxy {
12
13 VideoFrameResource::VideoFrameResource(PP_Instance instance,
14 int32_t index,
15 MediaStreamFrame::Video* frame)
16 : Resource(OBJECT_IS_PROXY, instance),
17 index_(index),
18 frame_(frame) {
19 }
20
21 VideoFrameResource::~VideoFrameResource() {
22 CHECK(!frame_) << "An unused (or unrecycled) frame is destroyed.";
23 }
24
25 thunk::PPB_VideoFrame_API* VideoFrameResource::AsPPB_VideoFrame_API() {
26 return this;
27 }
28
29 PP_TimeDelta VideoFrameResource::GetTimestamp() {
30 if (!frame_) {
31 VLOG(1) << "Frame is invalid";
32 return 0.0;
33 }
34 return frame_->timestamp;
35 }
36
37 void VideoFrameResource::SetTimestamp(PP_TimeDelta timestamp) {
38 if (!frame_) {
39 VLOG(1) << "Frame is invalid";
40 return;
41 }
42 frame_->timestamp = timestamp;
43 }
44
45 PP_VideoFrame_Format VideoFrameResource::GetFormat() {
46 if (!frame_) {
47 VLOG(1) << "Frame is invalid";
48 return PP_VIDEOFRAME_FORMAT_UNKNOWN;
49 }
50 return frame_->format;
51 }
52
53 PP_Bool VideoFrameResource::GetSize(PP_Size* size) {
54 if (!frame_) {
55 VLOG(1) << "Frame is invalid";
56 return PP_FALSE;
57 }
58 *size = frame_->size;
59 return PP_TRUE;
60 }
61
62 void* VideoFrameResource::GetDataBuffer() {
63 if (!frame_) {
64 VLOG(1) << "Frame is invalid";
65 return NULL;
66 }
67 return frame_->data;
68 }
69
70 uint32_t VideoFrameResource::GetDataBufferSize() {
71 if (!frame_) {
72 VLOG(1) << "Frame is invalid";
73 return 0;
74 }
75 return frame_->data_size;
76 }
77
78 } // namespace proxy
79 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698