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

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

Issue 1088553004: Set correct timestamp in PepperMediaStreamAudioTrack. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | no next file » | 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 #include "content/renderer/pepper/pepper_media_stream_audio_track_host.h" 5 #include "content/renderer/pepper/pepper_media_stream_audio_track_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 &(host_->buffer_manager()->GetBufferPointer(active_buffer_index_) 235 &(host_->buffer_manager()->GetBufferPointer(active_buffer_index_)
236 ->audio); 236 ->audio);
237 if (active_buffer_frame_offset_ == 0) { 237 if (active_buffer_frame_offset_ == 0) {
238 // The active buffer is new, so initialise the header and metadata fields. 238 // The active buffer is new, so initialise the header and metadata fields.
239 buffer->header.size = host_->buffer_manager()->buffer_size(); 239 buffer->header.size = host_->buffer_manager()->buffer_size();
240 buffer->header.type = ppapi::MediaStreamBuffer::TYPE_AUDIO; 240 buffer->header.type = ppapi::MediaStreamBuffer::TYPE_AUDIO;
241 const base::TimeTicks time_at_offset = estimated_capture_time + 241 const base::TimeTicks time_at_offset = estimated_capture_time +
242 frame_offset * base::TimeDelta::FromSeconds(1) / 242 frame_offset * base::TimeDelta::FromSeconds(1) /
243 audio_params_.sample_rate(); 243 audio_params_.sample_rate();
244 buffer->timestamp = 244 buffer->timestamp =
245 (time_at_offset - first_frame_capture_time_).InMillisecondsF(); 245 (time_at_offset - first_frame_capture_time_).InSecondsF();
246 buffer->sample_rate = 246 buffer->sample_rate =
247 static_cast<PP_AudioBuffer_SampleRate>(audio_params_.sample_rate()); 247 static_cast<PP_AudioBuffer_SampleRate>(audio_params_.sample_rate());
248 buffer->data_size = output_buffer_size_; 248 buffer->data_size = output_buffer_size_;
249 buffer->number_of_channels = audio_params_.channels(); 249 buffer->number_of_channels = audio_params_.channels();
250 buffer->number_of_samples = buffer->data_size * audio_params_.channels() / 250 buffer->number_of_samples = buffer->data_size * audio_params_.channels() /
251 bytes_per_frame; 251 bytes_per_frame;
252 } 252 }
253 253
254 const int frames_per_buffer = 254 const int frames_per_buffer =
255 buffer->number_of_samples / audio_params_.channels(); 255 buffer->number_of_samples / audio_params_.channels();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 // can't happen until the sink is added to the audio track below. 370 // can't happen until the sink is added to the audio track below.
371 if (format.IsValid()) 371 if (format.IsValid())
372 audio_sink_.OnSetFormat(format); 372 audio_sink_.OnSetFormat(format);
373 373
374 MediaStreamAudioSink::AddToAudioTrack(&audio_sink_, track_); 374 MediaStreamAudioSink::AddToAudioTrack(&audio_sink_, track_);
375 connected_ = true; 375 connected_ = true;
376 } 376 }
377 } 377 }
378 378
379 } // namespace content 379 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698