| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // TODO(scherkus): clean up PipelineImpl... too many crazy function names, | 5 // TODO(scherkus): clean up PipelineImpl... too many crazy function names, |
| 6 // potential deadlocks, etc... | 6 // potential deadlocks, etc... |
| 7 | 7 |
| 8 #include "media/base/pipeline_impl.h" | 8 #include "media/base/pipeline_impl.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/stl_util-inl.h" | 15 #include "base/stl_util-inl.h" |
| 16 #include "base/synchronization/condition_variable.h" | 16 #include "base/synchronization/condition_variable.h" |
| 17 #include "media/filters/rtc_video_decoder.h" | |
| 18 #include "media/base/clock.h" | 17 #include "media/base/clock.h" |
| 19 #include "media/base/filter_collection.h" | 18 #include "media/base/filter_collection.h" |
| 20 #include "media/base/media_format.h" | 19 #include "media/base/media_format.h" |
| 21 | 20 |
| 22 namespace media { | 21 namespace media { |
| 23 | 22 |
| 24 PipelineStatusNotification::PipelineStatusNotification() | 23 PipelineStatusNotification::PipelineStatusNotification() |
| 25 : cv_(&lock_), status_(PIPELINE_OK), notified_(false) { | 24 : cv_(&lock_), status_(PIPELINE_OK), notified_(false) { |
| 26 callback_.reset(NewCallback(this, &PipelineStatusNotification::Notify)); | 25 callback_.reset(NewCallback(this, &PipelineStatusNotification::Notify)); |
| 27 } | 26 } |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 DCHECK_EQ(kCreated, state_); | 609 DCHECK_EQ(kCreated, state_); |
| 611 filter_collection_.reset(filter_collection); | 610 filter_collection_.reset(filter_collection); |
| 612 url_ = url; | 611 url_ = url; |
| 613 seek_callback_.reset(start_callback); | 612 seek_callback_.reset(start_callback); |
| 614 | 613 |
| 615 // Kick off initialization. | 614 // Kick off initialization. |
| 616 pipeline_init_state_.reset(new PipelineInitState()); | 615 pipeline_init_state_.reset(new PipelineInitState()); |
| 617 pipeline_init_state_->composite_ = new CompositeFilter(message_loop_); | 616 pipeline_init_state_->composite_ = new CompositeFilter(message_loop_); |
| 618 pipeline_init_state_->composite_->set_host(this); | 617 pipeline_init_state_->composite_->set_host(this); |
| 619 | 618 |
| 620 if (RTCVideoDecoder::IsUrlSupported(url)) { | 619 bool raw_media = true; |
| 620 if (url.length() < strlen(kRawMediaScheme)) { |
| 621 raw_media = false; |
| 622 } else { |
| 623 const char* url_cstr = url.c_str(); |
| 624 int s_begin = 0; |
| 625 int s_end = strlen(kRawMediaScheme); |
| 626 for (int i = s_begin; i < s_end; ++i) { |
| 627 const char c = url_cstr[i]; |
| 628 const char c_lower = (c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c; |
| 629 if (!c_lower || c_lower != kRawMediaScheme[i]) { |
| 630 raw_media = false; |
| 631 break; |
| 632 } |
| 633 } |
| 634 } |
| 635 |
| 636 if (raw_media) { |
| 621 set_state(kInitVideoDecoder); | 637 set_state(kInitVideoDecoder); |
| 622 InitializeVideoDecoder(NULL); | 638 InitializeVideoDecoder(NULL); |
| 623 } else { | 639 } else { |
| 624 set_state(kInitDemuxer); | 640 set_state(kInitDemuxer); |
| 625 InitializeDemuxer(); | 641 InitializeDemuxer(); |
| 626 } | 642 } |
| 627 } | 643 } |
| 628 | 644 |
| 629 // Main initialization method called on the pipeline thread. This code attempts | 645 // Main initialization method called on the pipeline thread. This code attempts |
| 630 // to use the specified filter factory to build a pipeline. | 646 // to use the specified filter factory to build a pipeline. |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1300 case kStopping: | 1316 case kStopping: |
| 1301 case kStopped: | 1317 case kStopped: |
| 1302 NOTREACHED() << "Unexpected state for teardown: " << state_; | 1318 NOTREACHED() << "Unexpected state for teardown: " << state_; |
| 1303 break; | 1319 break; |
| 1304 // default: intentionally left out to force new states to cause compiler | 1320 // default: intentionally left out to force new states to cause compiler |
| 1305 // errors. | 1321 // errors. |
| 1306 }; | 1322 }; |
| 1307 } | 1323 } |
| 1308 | 1324 |
| 1309 } // namespace media | 1325 } // namespace media |
| OLD | NEW |