Index: media/filters/chunk_demuxer.cc |
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc |
index fd44eb8ac48233a6fbd55a75ed0f5271d1acaccc..37eeb4e09e29cf83db8100e38e26fea51dfed328 100644 |
--- a/media/filters/chunk_demuxer.cc |
+++ b/media/filters/chunk_demuxer.cc |
@@ -167,8 +167,8 @@ class ChunkDemuxerStream : public DemuxerStream { |
typedef std::deque<ReadCB> ReadCBQueue; |
typedef std::deque<base::Closure> ClosureQueue; |
- explicit ChunkDemuxerStream(const AudioDecoderConfig& audio_config); |
- explicit ChunkDemuxerStream(const VideoDecoderConfig& video_config); |
+ ChunkDemuxerStream(const AudioDecoderConfig& audio_config, bool is_encrypted); |
+ ChunkDemuxerStream(const VideoDecoderConfig& video_config, bool is_encrypted); |
void StartWaitingForSeek(); |
void Seek(TimeDelta time); |
@@ -193,8 +193,8 @@ class ChunkDemuxerStream : public DemuxerStream { |
// Called when mid-stream config updates occur. |
// Returns true if the new config is accepted. |
// Returns false if the new config should trigger an error. |
- bool UpdateAudioConfig(const AudioDecoderConfig& config); |
- bool UpdateVideoConfig(const VideoDecoderConfig& config); |
+ bool UpdateAudioConfig(const AudioDecoderConfig& config, bool is_encrypted); |
+ bool UpdateVideoConfig(const VideoDecoderConfig& config, bool is_encrypted); |
void EndOfStream(); |
bool CanEndOfStream() const; |
@@ -206,6 +206,7 @@ class ChunkDemuxerStream : public DemuxerStream { |
virtual void EnableBitstreamConverter() OVERRIDE; |
virtual const AudioDecoderConfig& audio_decoder_config() OVERRIDE; |
virtual const VideoDecoderConfig& video_decoder_config() OVERRIDE; |
+ virtual bool is_encrypted() OVERRIDE; |
protected: |
virtual ~ChunkDemuxerStream(); |
@@ -226,7 +227,7 @@ class ChunkDemuxerStream : public DemuxerStream { |
void DeferRead_Locked(const ReadCB& read_cb); |
// Creates closures that bind ReadCBs in |read_cbs_| to data in |
- // |buffers_| and pops the callbacks & buffers from the respecive queues. |
+ // |buffers_| and pops the callbacks & buffers from the respective queues. |
void CreateReadDoneClosures_Locked(ClosureQueue* closures); |
// Gets the value to pass to the next Read() callback. Returns true if |
@@ -244,21 +245,26 @@ class ChunkDemuxerStream : public DemuxerStream { |
State state_; |
ReadCBQueue read_cbs_; |
bool end_of_stream_; |
+ bool is_encrypted_; |
DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream); |
}; |
-ChunkDemuxerStream::ChunkDemuxerStream(const AudioDecoderConfig& audio_config) |
+ChunkDemuxerStream::ChunkDemuxerStream(const AudioDecoderConfig& audio_config, |
+ bool is_encrypted) |
: type_(AUDIO), |
state_(RETURNING_DATA_FOR_READS), |
- end_of_stream_(false) { |
+ end_of_stream_(false), |
+ is_encrypted_(is_encrypted) { |
stream_.reset(new SourceBufferStream(audio_config)); |
} |
-ChunkDemuxerStream::ChunkDemuxerStream(const VideoDecoderConfig& video_config) |
+ChunkDemuxerStream::ChunkDemuxerStream(const VideoDecoderConfig& video_config, |
+ bool is_encrypted) |
: type_(VIDEO), |
state_(RETURNING_DATA_FOR_READS), |
- end_of_stream_(false) { |
+ end_of_stream_(false), |
+ is_encrypted_(is_encrypted) { |
stream_.reset(new SourceBufferStream(video_config)); |
} |
@@ -358,15 +364,19 @@ Ranges<TimeDelta> ChunkDemuxerStream::GetBufferedRanges( |
return range.IntersectionWith(valid_time_range); |
} |
-bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config) { |
+bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config, |
+ bool is_encrypted) { |
DCHECK(config.IsValidConfig()); |
DCHECK_EQ(type_, AUDIO); |
+ is_encrypted_ = is_encrypted; |
acolwell GONE FROM CHROMIUM
2012/09/15 00:25:24
This is not correct. It will cause the is_encrypte
|
return stream_->UpdateAudioConfig(config); |
} |
-bool ChunkDemuxerStream::UpdateVideoConfig(const VideoDecoderConfig& config) { |
+bool ChunkDemuxerStream::UpdateVideoConfig(const VideoDecoderConfig& config, |
+ bool is_encrypted) { |
DCHECK(config.IsValidConfig()); |
DCHECK_EQ(type_, VIDEO); |
+ is_encrypted_ = is_encrypted; |
acolwell GONE FROM CHROMIUM
2012/09/15 00:25:24
ditto
|
return stream_->UpdateVideoConfig(config); |
} |
@@ -457,6 +467,11 @@ void ChunkDemuxerStream::ChangeState_Locked(State state) { |
state_ = state; |
} |
+bool ChunkDemuxerStream::is_encrypted() { |
+ base::AutoLock auto_lock(lock_); |
+ return is_encrypted_; |
+} |
+ |
ChunkDemuxerStream::~ChunkDemuxerStream() {} |
void ChunkDemuxerStream::DeferRead_Locked(const ReadCB& read_cb) { |
@@ -1019,7 +1034,9 @@ void ChunkDemuxer::OnStreamParserInitDone(bool success, TimeDelta duration) { |
bool ChunkDemuxer::OnNewConfigs(bool has_audio, bool has_video, |
const AudioDecoderConfig& audio_config, |
- const VideoDecoderConfig& video_config) { |
+ const VideoDecoderConfig& video_config, |
+ bool is_audio_encrypted, |
+ bool is_video_encrypted) { |
DVLOG(1) << "OnNewConfigs(" << has_audio << ", " << has_video |
<< ", " << audio_config.IsValidConfig() |
<< ", " << video_config.IsValidConfig() << ")"; |
@@ -1047,17 +1064,17 @@ bool ChunkDemuxer::OnNewConfigs(bool has_audio, bool has_video, |
bool success = true; |
if (audio_config.IsValidConfig()) { |
if (audio_) { |
- success &= audio_->UpdateAudioConfig(audio_config); |
+ success &= audio_->UpdateAudioConfig(audio_config, is_audio_encrypted); |
} else { |
- audio_ = new ChunkDemuxerStream(audio_config); |
+ audio_ = new ChunkDemuxerStream(audio_config, is_audio_encrypted); |
} |
} |
if (video_config.IsValidConfig()) { |
if (video_) { |
- success &= video_->UpdateVideoConfig(video_config); |
+ success &= video_->UpdateVideoConfig(video_config, is_video_encrypted); |
} else { |
- video_ = new ChunkDemuxerStream(video_config); |
+ video_ = new ChunkDemuxerStream(video_config, is_video_encrypted); |
} |
} |