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

Side by Side Diff: media/filters/audio_renderer_impl.cc

Issue 174584: Make audio and video in sync while playback rate != 1.0... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "media/base/filter_host.h" 5 #include "media/base/filter_host.h"
6 #include "media/filters/audio_renderer_impl.h" 6 #include "media/filters/audio_renderer_impl.h"
7 7
8 namespace media { 8 namespace media {
9 9
10 // We'll try to fill 4096 samples per buffer, which is roughly ~92ms of audio 10 // We'll try to fill 4096 samples per buffer, which is roughly ~92ms of audio
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 size_t AudioRendererImpl::OnMoreData(AudioOutputStream* stream, void* dest_void, 51 size_t AudioRendererImpl::OnMoreData(AudioOutputStream* stream, void* dest_void,
52 size_t len, int pending_bytes) { 52 size_t len, int pending_bytes) {
53 // TODO(scherkus): handle end of stream. 53 // TODO(scherkus): handle end of stream.
54 if (!stream_) 54 if (!stream_)
55 return 0; 55 return 0;
56 56
57 // TODO(scherkus): Maybe change OnMoreData to pass in char/uint8 or similar. 57 // TODO(scherkus): Maybe change OnMoreData to pass in char/uint8 or similar.
58 // TODO(fbarchard): Waveout_output_win.h should handle zero length buffers 58 // TODO(fbarchard): Waveout_output_win.h should handle zero length buffers
59 // without clicking. 59 // without clicking.
fbarchard 2009/08/27 03:21:18 we can probably remove this todo, now that we have
60 pending_bytes = static_cast<int>(pending_bytes * GetPlaybackRate());
scherkus (not reviewing) 2009/08/26 23:59:00 same here.. ceil() perhaps?
60 base::TimeDelta delay = base::TimeDelta::FromMicroseconds( 61 base::TimeDelta delay = base::TimeDelta::FromMicroseconds(
61 base::Time::kMicrosecondsPerSecond * pending_bytes / bytes_per_second_); 62 base::Time::kMicrosecondsPerSecond * pending_bytes / bytes_per_second_);
fbarchard 2009/08/27 03:21:18 this can come close to overflowing an int can't it
62 return FillBuffer(static_cast<uint8*>(dest_void), len, delay); 63 return FillBuffer(static_cast<uint8*>(dest_void), len, delay);
63 } 64 }
64 65
65 void AudioRendererImpl::OnClose(AudioOutputStream* stream) { 66 void AudioRendererImpl::OnClose(AudioOutputStream* stream) {
66 // TODO(scherkus): implement OnClose. 67 // TODO(scherkus): implement OnClose.
67 NOTIMPLEMENTED(); 68 NOTIMPLEMENTED();
68 } 69 }
69 70
70 void AudioRendererImpl::OnError(AudioOutputStream* stream, int code) { 71 void AudioRendererImpl::OnError(AudioOutputStream* stream, int code) {
71 // TODO(scherkus): implement OnError. 72 // TODO(scherkus): implement OnError.
(...skipping 25 matching lines...) Expand all
97 } 98 }
98 return true; 99 return true;
99 } 100 }
100 101
101 void AudioRendererImpl::OnStop() { 102 void AudioRendererImpl::OnStop() {
102 if (stream_) 103 if (stream_)
103 stream_->Stop(); 104 stream_->Stop();
104 } 105 }
105 106
106 } // namespace media 107 } // namespace media
OLDNEW
« chrome/renderer/media/audio_renderer_impl.cc ('K') | « chrome/renderer/media/audio_renderer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698