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

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

Issue 1547073003: Switch to standard integer types in content/renderer/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h>
6
5 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h"
6 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
7 #include "content/public/renderer/renderer_ppapi_host.h" 10 #include "content/public/renderer/renderer_ppapi_host.h"
8 #include "content/renderer/pepper/host_globals.h" 11 #include "content/renderer/pepper/host_globals.h"
9 #include "content/renderer/pepper/pepper_audio_encoder_host.h" 12 #include "content/renderer/pepper/pepper_audio_encoder_host.h"
10 #include "content/renderer/render_thread_impl.h" 13 #include "content/renderer/render_thread_impl.h"
11 #include "media/base/bind_to_current_loop.h" 14 #include "media/base/bind_to_current_loop.h"
12 #include "ppapi/c/pp_codecs.h" 15 #include "ppapi/c/pp_codecs.h"
13 #include "ppapi/c/pp_errors.h" 16 #include "ppapi/c/pp_errors.h"
14 #include "ppapi/host/dispatch_host_message.h" 17 #include "ppapi/host/dispatch_host_message.h"
15 #include "ppapi/host/ppapi_host.h" 18 #include "ppapi/host/ppapi_host.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 63
61 // Used on the media thread. 64 // Used on the media thread.
62 void Encode(uint8_t* input_data, 65 void Encode(uint8_t* input_data,
63 size_t input_size, 66 size_t input_size,
64 uint8_t* output_data, 67 uint8_t* output_data,
65 size_t output_size, 68 size_t output_size,
66 BitstreamBufferReadyCB callback); 69 BitstreamBufferReadyCB callback);
67 void RequestBitrateChange(uint32_t bitrate); 70 void RequestBitrateChange(uint32_t bitrate);
68 71
69 private: 72 private:
70 scoped_ptr<uint8[]> encoder_memory_; 73 scoped_ptr<uint8_t[]> encoder_memory_;
71 OpusEncoder* opus_encoder_; 74 OpusEncoder* opus_encoder_;
72 75
73 // Initialization parameters, only valid if |encoder_memory_| is not 76 // Initialization parameters, only valid if |encoder_memory_| is not
74 // nullptr. 77 // nullptr.
75 ppapi::proxy::PPB_AudioEncodeParameters parameters_; 78 ppapi::proxy::PPB_AudioEncodeParameters parameters_;
76 79
77 DISALLOW_COPY_AND_ASSIGN(AudioEncoderImpl); 80 DISALLOW_COPY_AND_ASSIGN(AudioEncoderImpl);
78 }; 81 };
79 82
80 PepperAudioEncoderHost::AudioEncoderImpl::AudioEncoderImpl() 83 PepperAudioEncoderHost::AudioEncoderImpl::AudioEncoderImpl()
(...skipping 23 matching lines...) Expand all
104 const ppapi::proxy::PPB_AudioEncodeParameters& parameters) { 107 const ppapi::proxy::PPB_AudioEncodeParameters& parameters) {
105 if (parameters.output_profile != PP_AUDIOPROFILE_OPUS) 108 if (parameters.output_profile != PP_AUDIOPROFILE_OPUS)
106 return false; 109 return false;
107 110
108 DCHECK(!encoder_memory_); 111 DCHECK(!encoder_memory_);
109 112
110 int32_t encoder_size = opus_encoder_get_size(parameters.channels); 113 int32_t encoder_size = opus_encoder_get_size(parameters.channels);
111 if (encoder_size < 1) 114 if (encoder_size < 1)
112 return false; 115 return false;
113 116
114 scoped_ptr<uint8[]> encoder_memory(new uint8[encoder_size]); 117 scoped_ptr<uint8_t[]> encoder_memory(new uint8_t[encoder_size]);
115 opus_encoder_ = reinterpret_cast<OpusEncoder*>(encoder_memory.get()); 118 opus_encoder_ = reinterpret_cast<OpusEncoder*>(encoder_memory.get());
116 119
117 if (opus_encoder_init(opus_encoder_, parameters.input_sample_rate, 120 if (opus_encoder_init(opus_encoder_, parameters.input_sample_rate,
118 parameters.channels, OPUS_APPLICATION_AUDIO) != OPUS_OK) 121 parameters.channels, OPUS_APPLICATION_AUDIO) != OPUS_OK)
119 return false; 122 return false;
120 123
121 if (opus_encoder_ctl(opus_encoder_, 124 if (opus_encoder_ctl(opus_encoder_,
122 OPUS_SET_BITRATE(parameters.initial_bitrate <= 0 125 OPUS_SET_BITRATE(parameters.initial_bitrate <= 0
123 ? OPUS_AUTO 126 ? OPUS_AUTO
124 : parameters.initial_bitrate)) != 127 : parameters.initial_bitrate)) !=
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 base::Passed(bitstream_buffer_manager_.Pass()))); 489 base::Passed(bitstream_buffer_manager_.Pass())));
487 } 490 }
488 491
489 // static 492 // static
490 void PepperAudioEncoderHost::StopAudioEncoder( 493 void PepperAudioEncoderHost::StopAudioEncoder(
491 scoped_ptr<AudioEncoderImpl> encoder, 494 scoped_ptr<AudioEncoderImpl> encoder,
492 scoped_ptr<ppapi::MediaStreamBufferManager> audio_buffer_manager, 495 scoped_ptr<ppapi::MediaStreamBufferManager> audio_buffer_manager,
493 scoped_ptr<ppapi::MediaStreamBufferManager> bitstream_buffer_manager) {} 496 scoped_ptr<ppapi::MediaStreamBufferManager> bitstream_buffer_manager) {}
494 497
495 } // namespace content 498 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_audio_encoder_host.h ('k') | content/renderer/pepper/pepper_audio_input_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698