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

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

Issue 156783003: Enhance AudioSplicer to crossfade marked splice frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clarity. Created 6 years, 10 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
« no previous file with comments | « no previous file | media/base/audio_splicer.cc » ('j') | media/base/audio_splicer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef MEDIA_BASE_AUDIO_SPLICER_H_ 5 #ifndef MEDIA_BASE_AUDIO_SPLICER_H_
6 #define MEDIA_BASE_AUDIO_SPLICER_H_ 6 #define MEDIA_BASE_AUDIO_SPLICER_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 11 matching lines...) Expand all
22 AudioSplicer(int samples_per_second); 22 AudioSplicer(int samples_per_second);
23 ~AudioSplicer(); 23 ~AudioSplicer();
24 24
25 // Resets the splicer state by clearing the output buffers queue, 25 // Resets the splicer state by clearing the output buffers queue,
26 // and resetting the timestamp helper. 26 // and resetting the timestamp helper.
27 void Reset(); 27 void Reset();
28 28
29 // Adds a new buffer full of samples or end of stream buffer to the splicer. 29 // Adds a new buffer full of samples or end of stream buffer to the splicer.
30 // Returns true if the buffer was accepted. False is returned if an error 30 // Returns true if the buffer was accepted. False is returned if an error
31 // occurred. 31 // occurred.
32 bool AddInput(const scoped_refptr<AudioBuffer>& input); 32 bool AddInput(const scoped_refptr<DecoderBuffer>& origin_buffer,
33 const scoped_refptr<AudioBuffer>& input);
33 34
34 // Returns true if the splicer has a buffer to return. 35 // Returns true if the splicer has a buffer to return.
35 bool HasNextBuffer() const; 36 bool HasNextBuffer() const;
36 37
37 // Removes the next buffer from the output buffer queue and returns it. 38 // Removes the next buffer from the output buffer queue and returns it.
38 // This should only be called if HasNextBuffer() returns true. 39 // This should only be called if HasNextBuffer() returns true.
39 scoped_refptr<AudioBuffer> GetNextBuffer(); 40 scoped_refptr<AudioBuffer> GetNextBuffer();
40 41
41 private: 42 private:
42 void AddOutputBuffer(const scoped_refptr<AudioBuffer>& buffer); 43 void AddOutputBuffer(const scoped_refptr<AudioBuffer>& buffer);
43 44
44 AudioTimestampHelper output_timestamp_helper_; 45 AudioTimestampHelper output_timestamp_helper_;
45
46 // Minimum gap size needed before the splicer will take action to
47 // fill a gap. This avoids periodically inserting and then dropping samples
48 // when the buffer timestamps are slightly off because of timestamp rounding
49 // in the source content. Unit is frames.
50 int min_gap_size_;
51
52 std::deque<scoped_refptr<AudioBuffer> > output_buffers_; 46 std::deque<scoped_refptr<AudioBuffer> > output_buffers_;
53 bool received_end_of_stream_; 47 bool received_end_of_stream_;
54 48
49 // Inner splicer for handling splice frames. Responsible for trimming and
50 // crossfading frames before exposing them for consumption by GetNextBuffer().
51 //
52 // Required since input buffers may require trimming arbitrarily large amounts
53 // of samples prior to crossfading. Adding those samples as is to the "outer"
54 // AudioSplicer will result in incorrect timestamp generation.
55 AudioSplicer splice_frame_splicer_;
acolwell GONE FROM CHROMIUM 2014/02/10 20:19:57 How does this compile? This is a recursive declara
DaleCurtis 2014/02/15 01:20:02 As discussed offline, it doesn't, sorry should hav
56
55 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSplicer); 57 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSplicer);
56 }; 58 };
57 59
58 } // namespace media 60 } // namespace media
59 61
60 #endif 62 #endif
OLDNEW
« no previous file with comments | « no previous file | media/base/audio_splicer.cc » ('j') | media/base/audio_splicer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698