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

Side by Side Diff: media/base/audio_splicer.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/audio_splicer.h" 5 #include "media/base/audio_splicer.h"
6 6
7 #include <cstdlib> 7 #include <cstdlib>
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 AudioStreamSanitizer(int samples_per_second, 63 AudioStreamSanitizer(int samples_per_second,
64 const scoped_refptr<MediaLog>& media_log); 64 const scoped_refptr<MediaLog>& media_log);
65 ~AudioStreamSanitizer(); 65 ~AudioStreamSanitizer();
66 66
67 // Resets the sanitizer state by clearing the output buffers queue, and 67 // Resets the sanitizer state by clearing the output buffers queue, and
68 // resetting the timestamp helper. 68 // resetting the timestamp helper.
69 void Reset(); 69 void Reset();
70 70
71 // Similar to Reset(), but initializes the timestamp helper with the given 71 // Similar to Reset(), but initializes the timestamp helper with the given
72 // parameters. 72 // parameters.
73 void ResetTimestampState(int64 frame_count, base::TimeDelta base_timestamp); 73 void ResetTimestampState(int64_t frame_count, base::TimeDelta base_timestamp);
74 74
75 // Adds a new buffer full of samples or end of stream buffer to the splicer. 75 // Adds a new buffer full of samples or end of stream buffer to the splicer.
76 // Returns true if the buffer was accepted. False is returned if an error 76 // Returns true if the buffer was accepted. False is returned if an error
77 // occurred. 77 // occurred.
78 bool AddInput(const scoped_refptr<AudioBuffer>& input); 78 bool AddInput(const scoped_refptr<AudioBuffer>& input);
79 79
80 // Returns true if the sanitizer has a buffer to return. 80 // Returns true if the sanitizer has a buffer to return.
81 bool HasNextBuffer() const; 81 bool HasNextBuffer() const;
82 82
83 // Removes the next buffer from the output buffer queue and returns it; should 83 // Removes the next buffer from the output buffer queue and returns it; should
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 int samples_per_second, 117 int samples_per_second,
118 const scoped_refptr<MediaLog>& media_log) 118 const scoped_refptr<MediaLog>& media_log)
119 : output_timestamp_helper_(samples_per_second), media_log_(media_log) {} 119 : output_timestamp_helper_(samples_per_second), media_log_(media_log) {}
120 120
121 AudioStreamSanitizer::~AudioStreamSanitizer() {} 121 AudioStreamSanitizer::~AudioStreamSanitizer() {}
122 122
123 void AudioStreamSanitizer::Reset() { 123 void AudioStreamSanitizer::Reset() {
124 ResetTimestampState(0, kNoTimestamp()); 124 ResetTimestampState(0, kNoTimestamp());
125 } 125 }
126 126
127 void AudioStreamSanitizer::ResetTimestampState(int64 frame_count, 127 void AudioStreamSanitizer::ResetTimestampState(int64_t frame_count,
128 base::TimeDelta base_timestamp) { 128 base::TimeDelta base_timestamp) {
129 output_buffers_.clear(); 129 output_buffers_.clear();
130 received_end_of_stream_ = false; 130 received_end_of_stream_ = false;
131 output_timestamp_helper_.SetBaseTimestamp(base_timestamp); 131 output_timestamp_helper_.SetBaseTimestamp(base_timestamp);
132 if (frame_count > 0) 132 if (frame_count > 0)
133 output_timestamp_helper_.AddFrames(frame_count); 133 output_timestamp_helper_.AddFrames(frame_count);
134 } 134 }
135 135
136 bool AudioStreamSanitizer::AddInput(const scoped_refptr<AudioBuffer>& input) { 136 bool AudioStreamSanitizer::AddInput(const scoped_refptr<AudioBuffer>& input) {
137 DCHECK(!received_end_of_stream_ || input->end_of_stream()); 137 DCHECK(!received_end_of_stream_ || input->end_of_stream());
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 AccurateTrimStart(frames_to_trim, remainder, output_ts_helper); 548 AccurateTrimStart(frames_to_trim, remainder, output_ts_helper);
549 CHECK(output_sanitizer_->AddInput(remainder)); 549 CHECK(output_sanitizer_->AddInput(remainder));
550 } 550 }
551 551
552 // Transfer all remaining buffers out and reset once empty. 552 // Transfer all remaining buffers out and reset once empty.
553 CHECK(post_splice_sanitizer_->DrainInto(output_sanitizer_.get())); 553 CHECK(post_splice_sanitizer_->DrainInto(output_sanitizer_.get()));
554 post_splice_sanitizer_->Reset(); 554 post_splice_sanitizer_->Reset();
555 } 555 }
556 556
557 } // namespace media 557 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698