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

Side by Side Diff: content/renderer/pepper/pepper_media_stream_video_track_host.cc

Issue 140783004: [PPAPI] Pepper MediaStream API audio track implementation and example. (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 unified diff | Download patch
OLDNEW
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 #include "content/renderer/pepper/pepper_media_stream_video_track_host.h" 5 #include "content/renderer/pepper/pepper_media_stream_video_track_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_video_frame.h" 9 #include "ppapi/c/ppb_video_frame.h"
10 #include "ppapi/shared_impl/media_stream_frame.h" 10 #include "ppapi/shared_impl/media_stream_frame.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return; 71 return;
72 72
73 if (frame_size_ != frame->coded_size() || frame_format_ != frame->format()) { 73 if (frame_size_ != frame->coded_size() || frame_format_ != frame->format()) {
74 frame_size_ = frame->coded_size(); 74 frame_size_ = frame->coded_size();
75 frame_format_ = frame->format(); 75 frame_format_ = frame->format();
76 // TODO(penghuang): Support changing |frame_size_| & |frame_format_| more 76 // TODO(penghuang): Support changing |frame_size_| & |frame_format_| more
77 // than once. 77 // than once.
78 DCHECK(!frame_data_size_); 78 DCHECK(!frame_data_size_);
79 frame_data_size_ = VideoFrame::AllocationSize(frame_format_, frame_size_); 79 frame_data_size_ = VideoFrame::AllocationSize(frame_format_, frame_size_);
80 int32_t size = sizeof(ppapi::MediaStreamFrame::Video) + frame_data_size_; 80 int32_t size = sizeof(ppapi::MediaStreamFrame::Video) + frame_data_size_;
81 InitFrames(kNumberOfFrames, size); 81 bool result = InitFrames(kNumberOfFrames, size);
82 // TODO(penghuang): Send PP_ERROR_NOMEMORY to plugin.
83 CHECK(result);
82 } 84 }
83 85
84 int32_t index = frame_buffer()->DequeueFrame(); 86 int32_t index = frame_buffer()->DequeueFrame();
85 // Drop frames if the underlying buffer is full. 87 // Drop frames if the underlying buffer is full.
86 if (index < 0) 88 if (index < 0)
87 return; 89 return;
88 90
89 // TODO(penghuang): support format conversion and size scaling. 91 // TODO(penghuang): support format conversion and size scaling.
90 ppapi::MediaStreamFrame::Video* ppframe = 92 ppapi::MediaStreamFrame::Video* ppframe =
91 &(frame_buffer()->GetFramePointer(index)->video); 93 &(frame_buffer()->GetFramePointer(index)->video);
(...skipping 27 matching lines...) Expand all
119 } 121 }
120 122
121 void PepperMediaStreamVideoTrackHost::DidConnectPendingHostToResource() { 123 void PepperMediaStreamVideoTrackHost::DidConnectPendingHostToResource() {
122 if (!connected_) { 124 if (!connected_) {
123 MediaStreamVideoSink::AddToVideoTrack(this, track_); 125 MediaStreamVideoSink::AddToVideoTrack(this, track_);
124 connected_ = true; 126 connected_ = true;
125 } 127 }
126 } 128 }
127 129
128 } // namespace content 130 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_media_stream_track_host_base.cc ('k') | content/renderer/pepper/resource_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698