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

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

Issue 1651673002: Add MediaCodecAudioDecoder implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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/decoder_buffer.h" 5 #include "media/base/decoder_buffer.h"
6 6
7 namespace media { 7 namespace media {
8 8
9 // Allocates a block of memory which is padded for use with the SIMD 9 // Allocates a block of memory which is padded for use with the SIMD
10 // optimizations used by FFmpeg. 10 // optimizations used by FFmpeg.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 << " encrypted: " << (decrypt_config_ != NULL) 92 << " encrypted: " << (decrypt_config_ != NULL)
93 << " discard_padding (ms): (" << discard_padding_.first.InMilliseconds() 93 << " discard_padding (ms): (" << discard_padding_.first.InMilliseconds()
94 << ", " << discard_padding_.second.InMilliseconds() << ")"; 94 << ", " << discard_padding_.second.InMilliseconds() << ")";
95 95
96 if (decrypt_config_) 96 if (decrypt_config_)
97 s << " decrypt:" << (*decrypt_config_); 97 s << " decrypt:" << (*decrypt_config_);
98 98
99 return s.str(); 99 return s.str();
100 } 100 }
101 101
102 std::string DecoderBuffer::AsShortString() {
103 if (end_of_stream()) {
104 return "EOS";
105 }
106
107 std::ostringstream s;
108 s << "timestamp: " << timestamp_;
109 if (is_key_frame_)
110 s << " KEY";
111 if (decrypt_config_)
112 s << " decrypt:" << (*decrypt_config_);
113
114 return s.str();
115 }
116
102 void DecoderBuffer::set_timestamp(base::TimeDelta timestamp) { 117 void DecoderBuffer::set_timestamp(base::TimeDelta timestamp) {
103 DCHECK(!end_of_stream()); 118 DCHECK(!end_of_stream());
104 timestamp_ = timestamp; 119 timestamp_ = timestamp;
105 } 120 }
106 121
107 void DecoderBuffer::CopySideDataFrom(const uint8_t* side_data, 122 void DecoderBuffer::CopySideDataFrom(const uint8_t* side_data,
108 size_t side_data_size) { 123 size_t side_data_size) {
109 if (side_data_size > 0) { 124 if (side_data_size > 0) {
110 side_data_size_ = side_data_size; 125 side_data_size_ = side_data_size;
111 side_data_.reset(AllocateFFmpegSafeBlock(side_data_size_)); 126 side_data_.reset(AllocateFFmpegSafeBlock(side_data_size_));
112 memcpy(side_data_.get(), side_data, side_data_size_); 127 memcpy(side_data_.get(), side_data, side_data_size_);
113 } else { 128 } else {
114 side_data_.reset(); 129 side_data_.reset();
115 side_data_size_ = 0; 130 side_data_size_ = 0;
116 } 131 }
117 } 132 }
118 133
119 } // namespace media 134 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698