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

Side by Side Diff: media/formats/webm/webm_audio_client.cc

Issue 1786733004: Revert of media config: expand is_encrypted to a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « media/formats/webm/webm_audio_client.h ('k') | media/formats/webm/webm_tracks_parser.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/formats/webm/webm_audio_client.h" 5 #include "media/formats/webm/webm_audio_client.h"
6 6
7 #include "media/base/audio_decoder_config.h" 7 #include "media/base/audio_decoder_config.h"
8 #include "media/base/channel_layout.h" 8 #include "media/base/channel_layout.h"
9 #include "media/formats/webm/webm_constants.h" 9 #include "media/formats/webm/webm_constants.h"
10 10
(...skipping 11 matching lines...) Expand all
22 channels_ = -1; 22 channels_ = -1;
23 samples_per_second_ = -1; 23 samples_per_second_ = -1;
24 output_samples_per_second_ = -1; 24 output_samples_per_second_ = -1;
25 } 25 }
26 26
27 bool WebMAudioClient::InitializeConfig( 27 bool WebMAudioClient::InitializeConfig(
28 const std::string& codec_id, 28 const std::string& codec_id,
29 const std::vector<uint8_t>& codec_private, 29 const std::vector<uint8_t>& codec_private,
30 int64_t seek_preroll, 30 int64_t seek_preroll,
31 int64_t codec_delay, 31 int64_t codec_delay,
32 const EncryptionScheme& encryption_scheme, 32 bool is_encrypted,
33 AudioDecoderConfig* config) { 33 AudioDecoderConfig* config) {
34 DCHECK(config); 34 DCHECK(config);
35 SampleFormat sample_format = kSampleFormatPlanarF32; 35 SampleFormat sample_format = kSampleFormatPlanarF32;
36 36
37 AudioCodec audio_codec = kUnknownAudioCodec; 37 AudioCodec audio_codec = kUnknownAudioCodec;
38 if (codec_id == "A_VORBIS") { 38 if (codec_id == "A_VORBIS") {
39 audio_codec = kCodecVorbis; 39 audio_codec = kCodecVorbis;
40 } else if (codec_id == "A_OPUS") { 40 } else if (codec_id == "A_OPUS") {
41 audio_codec = kCodecOpus; 41 audio_codec = kCodecOpus;
42 } else { 42 } else {
(...skipping 28 matching lines...) Expand all
71 71
72 // Convert |codec_delay| from nanoseconds into frames. 72 // Convert |codec_delay| from nanoseconds into frames.
73 int codec_delay_in_frames = 0; 73 int codec_delay_in_frames = 0;
74 if (codec_delay != -1) { 74 if (codec_delay != -1) {
75 codec_delay_in_frames = 75 codec_delay_in_frames =
76 0.5 + 76 0.5 +
77 samples_per_second * (static_cast<double>(codec_delay) / 77 samples_per_second * (static_cast<double>(codec_delay) /
78 base::Time::kNanosecondsPerSecond); 78 base::Time::kNanosecondsPerSecond);
79 } 79 }
80 80
81 config->Initialize(audio_codec, sample_format, channel_layout, 81 config->Initialize(
82 samples_per_second, codec_private, encryption_scheme, 82 audio_codec,
83 base::TimeDelta::FromMicroseconds( 83 sample_format,
84 (seek_preroll != -1 ? seek_preroll : 0) / 1000), 84 channel_layout,
85 codec_delay_in_frames); 85 samples_per_second,
86 codec_private,
87 is_encrypted,
88 base::TimeDelta::FromMicroseconds(
89 (seek_preroll != -1 ? seek_preroll : 0) / 1000),
90 codec_delay_in_frames);
86 return config->IsValidConfig(); 91 return config->IsValidConfig();
87 } 92 }
88 93
89 bool WebMAudioClient::OnUInt(int id, int64_t val) { 94 bool WebMAudioClient::OnUInt(int id, int64_t val) {
90 if (id == kWebMIdChannels) { 95 if (id == kWebMIdChannels) {
91 if (channels_ != -1) { 96 if (channels_ != -1) {
92 MEDIA_LOG(ERROR, media_log_) << "Multiple values for id " << std::hex 97 MEDIA_LOG(ERROR, media_log_) << "Multiple values for id " << std::hex
93 << id << " specified. (" << channels_ 98 << id << " specified. (" << channels_
94 << " and " << val << ")"; 99 << " and " << val << ")";
95 return false; 100 return false;
(...skipping 26 matching lines...) Expand all
122 << " specified (" << *dst << " and " << val 127 << " specified (" << *dst << " and " << val
123 << ")"; 128 << ")";
124 return false; 129 return false;
125 } 130 }
126 131
127 *dst = val; 132 *dst = val;
128 return true; 133 return true;
129 } 134 }
130 135
131 } // namespace media 136 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/webm/webm_audio_client.h ('k') | media/formats/webm/webm_tracks_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698