OLD | NEW |
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/webm/webm_stream_parser.h" | 5 #include "media/webm/webm_stream_parser.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 return -1; | 345 return -1; |
346 } | 346 } |
347 | 347 |
348 bool is_audio_encrypted = !tracks_parser.audio_encryption_key_id().empty(); | 348 bool is_audio_encrypted = !tracks_parser.audio_encryption_key_id().empty(); |
349 AudioDecoderConfig audio_config; | 349 AudioDecoderConfig audio_config; |
350 if (is_audio_encrypted) { | 350 if (is_audio_encrypted) { |
351 const AudioDecoderConfig& original_audio_config = | 351 const AudioDecoderConfig& original_audio_config = |
352 config_helper.audio_config(); | 352 config_helper.audio_config(); |
353 | 353 |
354 audio_config.Initialize(original_audio_config.codec(), | 354 audio_config.Initialize(original_audio_config.codec(), |
355 original_audio_config.bits_per_channel(), | 355 original_audio_config.sample_format(), |
356 original_audio_config.channel_layout(), | 356 original_audio_config.channel_layout(), |
357 original_audio_config.samples_per_second(), | 357 original_audio_config.samples_per_second(), |
358 original_audio_config.extra_data(), | 358 original_audio_config.extra_data(), |
359 original_audio_config.extra_data_size(), | 359 original_audio_config.extra_data_size(), |
360 is_audio_encrypted, false); | 360 is_audio_encrypted, |
| 361 false); |
361 | 362 |
362 FireNeedKey(tracks_parser.audio_encryption_key_id()); | 363 FireNeedKey(tracks_parser.audio_encryption_key_id()); |
363 } else { | 364 } else { |
364 audio_config.CopyFrom(config_helper.audio_config()); | 365 audio_config.CopyFrom(config_helper.audio_config()); |
365 } | 366 } |
366 | 367 |
367 bool is_video_encrypted = !tracks_parser.video_encryption_key_id().empty(); | 368 bool is_video_encrypted = !tracks_parser.video_encryption_key_id().empty(); |
368 VideoDecoderConfig video_config; | 369 VideoDecoderConfig video_config; |
369 if (is_video_encrypted) { | 370 if (is_video_encrypted) { |
370 const VideoDecoderConfig& original_video_config = | 371 const VideoDecoderConfig& original_video_config = |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 | 466 |
466 void WebMStreamParser::FireNeedKey(const std::string& key_id) { | 467 void WebMStreamParser::FireNeedKey(const std::string& key_id) { |
467 int key_id_size = key_id.size(); | 468 int key_id_size = key_id.size(); |
468 DCHECK_GT(key_id_size, 0); | 469 DCHECK_GT(key_id_size, 0); |
469 scoped_array<uint8> key_id_array(new uint8[key_id_size]); | 470 scoped_array<uint8> key_id_array(new uint8[key_id_size]); |
470 memcpy(key_id_array.get(), key_id.data(), key_id_size); | 471 memcpy(key_id_array.get(), key_id.data(), key_id_size); |
471 need_key_cb_.Run(kWebMInitDataType, key_id_array.Pass(), key_id_size); | 472 need_key_cb_.Run(kWebMInitDataType, key_id_array.Pass(), key_id_size); |
472 } | 473 } |
473 | 474 |
474 } // namespace media | 475 } // namespace media |
OLD | NEW |