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

Side by Side Diff: ppapi/thunk/ppb_audio_frame_thunk.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
« no previous file with comments | « ppapi/thunk/ppb_audio_frame_api.h ('k') | ppapi/thunk/ppb_media_stream_audio_track_thunk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // From ppb_audio_frame.idl modified Wed Jan 22 09:11:35 2014. 5 // From ppb_audio_frame.idl modified Thu Jan 23 15:09:57 2014.
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_audio_frame.h" 8 #include "ppapi/c/ppb_audio_frame.h"
9 #include "ppapi/shared_impl/tracked_callback.h" 9 #include "ppapi/shared_impl/tracked_callback.h"
10 #include "ppapi/thunk/enter.h" 10 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/ppapi_thunk_export.h" 11 #include "ppapi/thunk/ppapi_thunk_export.h"
12 #include "ppapi/thunk/ppb_audio_frame_api.h" 12 #include "ppapi/thunk/ppb_audio_frame_api.h"
13 13
14 namespace ppapi { 14 namespace ppapi {
15 namespace thunk { 15 namespace thunk {
(...skipping 15 matching lines...) Expand all
31 } 31 }
32 32
33 void SetTimestamp(PP_Resource frame, PP_TimeDelta timestamp) { 33 void SetTimestamp(PP_Resource frame, PP_TimeDelta timestamp) {
34 VLOG(4) << "PPB_AudioFrame::SetTimestamp()"; 34 VLOG(4) << "PPB_AudioFrame::SetTimestamp()";
35 EnterResource<PPB_AudioFrame_API> enter(frame, true); 35 EnterResource<PPB_AudioFrame_API> enter(frame, true);
36 if (enter.failed()) 36 if (enter.failed())
37 return; 37 return;
38 enter.object()->SetTimestamp(timestamp); 38 enter.object()->SetTimestamp(timestamp);
39 } 39 }
40 40
41 PP_AudioFrame_SampleRate GetSampleRate(PP_Resource frame) {
42 VLOG(4) << "PPB_AudioFrame::GetSampleRate()";
43 EnterResource<PPB_AudioFrame_API> enter(frame, true);
44 if (enter.failed())
45 return PP_AUDIOFRAME_SAMPLERATE_UNKNOWN;
46 return enter.object()->GetSampleRate();
47 }
48
41 PP_AudioFrame_SampleSize GetSampleSize(PP_Resource frame) { 49 PP_AudioFrame_SampleSize GetSampleSize(PP_Resource frame) {
42 VLOG(4) << "PPB_AudioFrame::GetSampleSize()"; 50 VLOG(4) << "PPB_AudioFrame::GetSampleSize()";
43 EnterResource<PPB_AudioFrame_API> enter(frame, true); 51 EnterResource<PPB_AudioFrame_API> enter(frame, true);
44 if (enter.failed()) 52 if (enter.failed())
45 return PP_AUDIOFRAME_SAMPLESIZE_UNKNOWN; 53 return PP_AUDIOFRAME_SAMPLESIZE_UNKNOWN;
46 return enter.object()->GetSampleSize(); 54 return enter.object()->GetSampleSize();
47 } 55 }
48 56
49 uint32_t GetNumberOfChannels(PP_Resource frame) { 57 uint32_t GetNumberOfChannels(PP_Resource frame) {
50 VLOG(4) << "PPB_AudioFrame::GetNumberOfChannels()"; 58 VLOG(4) << "PPB_AudioFrame::GetNumberOfChannels()";
(...skipping 24 matching lines...) Expand all
75 EnterResource<PPB_AudioFrame_API> enter(frame, true); 83 EnterResource<PPB_AudioFrame_API> enter(frame, true);
76 if (enter.failed()) 84 if (enter.failed())
77 return 0; 85 return 0;
78 return enter.object()->GetDataBufferSize(); 86 return enter.object()->GetDataBufferSize();
79 } 87 }
80 88
81 const PPB_AudioFrame_0_1 g_ppb_audioframe_thunk_0_1 = { 89 const PPB_AudioFrame_0_1 g_ppb_audioframe_thunk_0_1 = {
82 &IsAudioFrame, 90 &IsAudioFrame,
83 &GetTimestamp, 91 &GetTimestamp,
84 &SetTimestamp, 92 &SetTimestamp,
93 &GetSampleRate,
85 &GetSampleSize, 94 &GetSampleSize,
86 &GetNumberOfChannels, 95 &GetNumberOfChannels,
87 &GetNumberOfSamples, 96 &GetNumberOfSamples,
88 &GetDataBuffer, 97 &GetDataBuffer,
89 &GetDataBufferSize 98 &GetDataBufferSize
90 }; 99 };
91 100
92 } // namespace 101 } // namespace
93 102
94 PPAPI_THUNK_EXPORT const PPB_AudioFrame_0_1* GetPPB_AudioFrame_0_1_Thunk() { 103 PPAPI_THUNK_EXPORT const PPB_AudioFrame_0_1* GetPPB_AudioFrame_0_1_Thunk() {
95 return &g_ppb_audioframe_thunk_0_1; 104 return &g_ppb_audioframe_thunk_0_1;
96 } 105 }
97 106
98 } // namespace thunk 107 } // namespace thunk
99 } // namespace ppapi 108 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_audio_frame_api.h ('k') | ppapi/thunk/ppb_media_stream_audio_track_thunk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698