| 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 #include "ppapi/cpp/media_stream_audio_track.h" | 5 #include "ppapi/cpp/media_stream_audio_track.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/c/ppb_media_stream_audio_track.h" | 8 #include "ppapi/c/ppb_media_stream_audio_track.h" |
| 9 #include "ppapi/cpp/audio_frame.h" | 9 #include "ppapi/cpp/audio_buffer.h" |
| 10 #include "ppapi/cpp/completion_callback.h" | 10 #include "ppapi/cpp/completion_callback.h" |
| 11 #include "ppapi/cpp/module_impl.h" | 11 #include "ppapi/cpp/module_impl.h" |
| 12 #include "ppapi/cpp/var.h" | 12 #include "ppapi/cpp/var.h" |
| 13 | 13 |
| 14 namespace pp { | 14 namespace pp { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 template <> const char* interface_name<PPB_MediaStreamAudioTrack_0_1>() { | 18 template <> const char* interface_name<PPB_MediaStreamAudioTrack_0_1>() { |
| 19 return PPB_MEDIASTREAMAUDIOTRACK_INTERFACE_0_1; | 19 return PPB_MEDIASTREAMAUDIOTRACK_INTERFACE_0_1; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 | 71 |
| 72 bool MediaStreamAudioTrack::HasEnded() const { | 72 bool MediaStreamAudioTrack::HasEnded() const { |
| 73 if (has_interface<PPB_MediaStreamAudioTrack_0_1>()) { | 73 if (has_interface<PPB_MediaStreamAudioTrack_0_1>()) { |
| 74 return PP_ToBool(get_interface<PPB_MediaStreamAudioTrack_0_1>()->HasEnded( | 74 return PP_ToBool(get_interface<PPB_MediaStreamAudioTrack_0_1>()->HasEnded( |
| 75 pp_resource())); | 75 pp_resource())); |
| 76 } | 76 } |
| 77 return true; | 77 return true; |
| 78 } | 78 } |
| 79 | 79 |
| 80 int32_t MediaStreamAudioTrack::GetFrame( | 80 int32_t MediaStreamAudioTrack::GetBuffer( |
| 81 const CompletionCallbackWithOutput<AudioFrame>& callback) { | 81 const CompletionCallbackWithOutput<AudioBuffer>& callback) { |
| 82 if (has_interface<PPB_MediaStreamAudioTrack_0_1>()) { | 82 if (has_interface<PPB_MediaStreamAudioTrack_0_1>()) { |
| 83 return get_interface<PPB_MediaStreamAudioTrack_0_1>()->GetFrame( | 83 return get_interface<PPB_MediaStreamAudioTrack_0_1>()->GetBuffer( |
| 84 pp_resource(), callback.output(), callback.pp_completion_callback()); | 84 pp_resource(), callback.output(), callback.pp_completion_callback()); |
| 85 } | 85 } |
| 86 return callback.MayForce(PP_ERROR_NOINTERFACE); | 86 return callback.MayForce(PP_ERROR_NOINTERFACE); |
| 87 } | 87 } |
| 88 | 88 |
| 89 int32_t MediaStreamAudioTrack::RecycleFrame(const AudioFrame& frame) { | 89 int32_t MediaStreamAudioTrack::RecycleBuffer(const AudioBuffer& buffer) { |
| 90 if (has_interface<PPB_MediaStreamAudioTrack_0_1>()) { | 90 if (has_interface<PPB_MediaStreamAudioTrack_0_1>()) { |
| 91 return get_interface<PPB_MediaStreamAudioTrack_0_1>()->RecycleFrame( | 91 return get_interface<PPB_MediaStreamAudioTrack_0_1>()->RecycleBuffer( |
| 92 pp_resource(), frame.pp_resource()); | 92 pp_resource(), buffer.pp_resource()); |
| 93 } | 93 } |
| 94 return PP_ERROR_NOINTERFACE; | 94 return PP_ERROR_NOINTERFACE; |
| 95 } | 95 } |
| 96 | 96 |
| 97 void MediaStreamAudioTrack::Close() { | 97 void MediaStreamAudioTrack::Close() { |
| 98 if (has_interface<PPB_MediaStreamAudioTrack_0_1>()) | 98 if (has_interface<PPB_MediaStreamAudioTrack_0_1>()) |
| 99 get_interface<PPB_MediaStreamAudioTrack_0_1>()->Close(pp_resource()); | 99 get_interface<PPB_MediaStreamAudioTrack_0_1>()->Close(pp_resource()); |
| 100 } | 100 } |
| 101 | 101 |
| 102 // static | 102 // static |
| 103 bool MediaStreamAudioTrack::IsMediaStreamAudioTrack(const Resource& resource) { | 103 bool MediaStreamAudioTrack::IsMediaStreamAudioTrack(const Resource& resource) { |
| 104 if (has_interface<PPB_MediaStreamAudioTrack_0_1>()) { | 104 if (has_interface<PPB_MediaStreamAudioTrack_0_1>()) { |
| 105 return PP_ToBool(get_interface<PPB_MediaStreamAudioTrack_0_1>()-> | 105 return PP_ToBool(get_interface<PPB_MediaStreamAudioTrack_0_1>()-> |
| 106 IsMediaStreamAudioTrack(resource.pp_resource())); | 106 IsMediaStreamAudioTrack(resource.pp_resource())); |
| 107 } | 107 } |
| 108 return false; | 108 return false; |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace pp | 111 } // namespace pp |
| OLD | NEW |