OLD | NEW |
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 Loading... |
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 |
OLD | NEW |