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

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

Issue 265943002: Revert of Remove AudioBuffer::set_duration(), instead base on frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « media/base/audio_buffer_unittest.cc ('k') | media/base/audio_discard_helper_unittest.cc » ('j') | 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 "media/base/audio_discard_helper.h" 5 #include "media/base/audio_discard_helper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/base/audio_buffer.h" 10 #include "media/base/audio_buffer.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 // If everything would be discarded, indicate a new buffer is required. 97 // If everything would be discarded, indicate a new buffer is required.
98 if (end_frames_to_discard == decoded_frames) 98 if (end_frames_to_discard == decoded_frames)
99 return false; 99 return false;
100 100
101 decoded_buffer->TrimEnd(end_frames_to_discard); 101 decoded_buffer->TrimEnd(end_frames_to_discard);
102 } else { 102 } else {
103 DCHECK(encoded_buffer->discard_padding() == base::TimeDelta()); 103 DCHECK(encoded_buffer->discard_padding() == base::TimeDelta());
104 } 104 }
105 105
106 // Assign timestamp to the buffer. 106 // Assign timestamp and duration to the buffer.
107 decoded_buffer->set_timestamp(timestamp_helper_.GetTimestamp()); 107 decoded_buffer->set_timestamp(timestamp_helper_.GetTimestamp());
108 decoded_buffer->set_duration(
109 timestamp_helper_.GetFrameDuration(decoded_buffer->frame_count()));
108 timestamp_helper_.AddFrames(decoded_buffer->frame_count()); 110 timestamp_helper_.AddFrames(decoded_buffer->frame_count());
109 return true; 111 return true;
110 } 112 }
111 113
112 } // namespace media 114 } // namespace media
OLDNEW
« no previous file with comments | « media/base/audio_buffer_unittest.cc ('k') | media/base/audio_discard_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698