| 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/chunk_demuxer.h" | 5 #include "media/filters/chunk_demuxer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 *status = DemuxerStream::kOk; | 513 *status = DemuxerStream::kOk; |
| 514 return true; | 514 return true; |
| 515 case SourceBufferStream::kNeedBuffer: | 515 case SourceBufferStream::kNeedBuffer: |
| 516 if (end_of_stream_) { | 516 if (end_of_stream_) { |
| 517 *status = DemuxerStream::kOk; | 517 *status = DemuxerStream::kOk; |
| 518 *buffer = StreamParserBuffer::CreateEOSBuffer(); | 518 *buffer = StreamParserBuffer::CreateEOSBuffer(); |
| 519 return true; | 519 return true; |
| 520 } | 520 } |
| 521 return false; | 521 return false; |
| 522 case SourceBufferStream::kConfigChange: | 522 case SourceBufferStream::kConfigChange: |
| 523 DVLOG(2) << "Config change reported to ChunkDemuxerStream."; |
| 523 *status = kConfigChanged; | 524 *status = kConfigChanged; |
| 524 *buffer = NULL; | 525 *buffer = NULL; |
| 525 return true; | 526 return true; |
| 526 } | 527 } |
| 527 break; | 528 break; |
| 528 case CANCELED: | 529 case CANCELED: |
| 529 case WAITING_FOR_SEEK: | 530 case WAITING_FOR_SEEK: |
| 530 // Null buffers should be returned in this state since we are waiting | 531 // Null buffers should be returned in this state since we are waiting |
| 531 // for a seek. Any buffers in the SourceBuffer should NOT be returned | 532 // for a seek. Any buffers in the SourceBuffer should NOT be returned |
| 532 // because they are associated with the seek. | 533 // because they are associated with the seek. |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 } | 1112 } |
| 1112 | 1113 |
| 1113 if (video_config.IsValidConfig()) { | 1114 if (video_config.IsValidConfig()) { |
| 1114 if (video_) { | 1115 if (video_) { |
| 1115 success &= video_->UpdateVideoConfig(video_config); | 1116 success &= video_->UpdateVideoConfig(video_config); |
| 1116 } else { | 1117 } else { |
| 1117 video_ = new ChunkDemuxerStream(video_config, log_cb_); | 1118 video_ = new ChunkDemuxerStream(video_config, log_cb_); |
| 1118 } | 1119 } |
| 1119 } | 1120 } |
| 1120 | 1121 |
| 1121 DVLOG(1) << "OnNewConfigs() : success " << success; | 1122 DVLOG(1) << "OnNewConfigs() : " << (success ? "success" : "failed"); |
| 1122 return success; | 1123 return success; |
| 1123 } | 1124 } |
| 1124 | 1125 |
| 1125 bool ChunkDemuxer::OnAudioBuffers(const StreamParser::BufferQueue& buffers) { | 1126 bool ChunkDemuxer::OnAudioBuffers(const StreamParser::BufferQueue& buffers) { |
| 1126 lock_.AssertAcquired(); | 1127 lock_.AssertAcquired(); |
| 1127 DCHECK_NE(state_, SHUTDOWN); | 1128 DCHECK_NE(state_, SHUTDOWN); |
| 1128 | 1129 |
| 1129 if (!audio_) | 1130 if (!audio_) |
| 1130 return false; | 1131 return false; |
| 1131 | 1132 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 | 1247 |
| 1247 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { | 1248 Ranges<TimeDelta> ChunkDemuxer::GetBufferedRanges() const { |
| 1248 if (audio_ && !video_) | 1249 if (audio_ && !video_) |
| 1249 return audio_->GetBufferedRanges(duration_); | 1250 return audio_->GetBufferedRanges(duration_); |
| 1250 else if (!audio_ && video_) | 1251 else if (!audio_ && video_) |
| 1251 return video_->GetBufferedRanges(duration_); | 1252 return video_->GetBufferedRanges(duration_); |
| 1252 return ComputeIntersection(); | 1253 return ComputeIntersection(); |
| 1253 } | 1254 } |
| 1254 | 1255 |
| 1255 } // namespace media | 1256 } // namespace media |
| OLD | NEW |