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/filters/decrypting_demuxer_stream.h" | 5 #include "media/filters/decrypting_demuxer_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 return Decryptor::kAudio; | 366 return Decryptor::kAudio; |
367 | 367 |
368 DCHECK_EQ(demuxer_stream_->type(), VIDEO); | 368 DCHECK_EQ(demuxer_stream_->type(), VIDEO); |
369 return Decryptor::kVideo; | 369 return Decryptor::kVideo; |
370 } | 370 } |
371 | 371 |
372 void DecryptingDemuxerStream::InitializeDecoderConfig() { | 372 void DecryptingDemuxerStream::InitializeDecoderConfig() { |
373 // The decoder selector or upstream demuxer make sure the stream is valid. | 373 // The decoder selector or upstream demuxer make sure the stream is valid. |
374 DCHECK(IsStreamValid(demuxer_stream_)); | 374 DCHECK(IsStreamValid(demuxer_stream_)); |
375 | 375 |
| 376 // Since |this| is a decrypted version of |demuxer_stream_|, the decoder |
| 377 // config of |this| should always be a decrypted version of |demuxer_stream_| |
| 378 // configs. |
376 switch (demuxer_stream_->type()) { | 379 switch (demuxer_stream_->type()) { |
377 case AUDIO: { | 380 case AUDIO: { |
378 AudioDecoderConfig input_audio_config = | 381 audio_config_ = demuxer_stream_->audio_decoder_config(); |
379 demuxer_stream_->audio_decoder_config(); | 382 if (audio_config_.is_encrypted()) |
380 audio_config_.Initialize( | 383 audio_config_.SetIsEncrypted(false); |
381 input_audio_config.codec(), input_audio_config.sample_format(), | |
382 input_audio_config.channel_layout(), | |
383 input_audio_config.samples_per_second(), | |
384 input_audio_config.extra_data(), Unencrypted(), | |
385 input_audio_config.seek_preroll(), input_audio_config.codec_delay()); | |
386 break; | 384 break; |
387 } | 385 } |
388 | 386 |
389 case VIDEO: { | 387 case VIDEO: { |
390 VideoDecoderConfig input_video_config = | 388 video_config_ = demuxer_stream_->video_decoder_config(); |
391 demuxer_stream_->video_decoder_config(); | 389 if (video_config_.is_encrypted()) |
392 video_config_.Initialize( | 390 video_config_.SetIsEncrypted(false); |
393 input_video_config.codec(), input_video_config.profile(), | |
394 input_video_config.format(), input_video_config.color_space(), | |
395 input_video_config.coded_size(), input_video_config.visible_rect(), | |
396 input_video_config.natural_size(), input_video_config.extra_data(), | |
397 Unencrypted()); | |
398 break; | 391 break; |
399 } | 392 } |
400 | 393 |
401 default: | 394 default: |
402 NOTREACHED(); | 395 NOTREACHED(); |
403 return; | 396 return; |
404 } | 397 } |
405 } | 398 } |
406 | 399 |
407 } // namespace media | 400 } // namespace media |
OLD | NEW |