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/string_util.h" |
16 #include "base/synchronization/condition_variable.h" | 17 #include "base/synchronization/condition_variable.h" |
17 #include "media/filters/rtc_video_decoder.h" | |
18 #include "media/base/clock.h" | 18 #include "media/base/clock.h" |
19 #include "media/base/filter_collection.h" | 19 #include "media/base/filter_collection.h" |
20 #include "media/base/media_format.h" | 20 #include "media/base/media_format.h" |
21 | 21 |
22 namespace media { | 22 namespace media { |
23 | 23 |
| 24 const char kRawMediaScheme[] = "x-raw-media"; |
| 25 |
24 PipelineStatusNotification::PipelineStatusNotification() | 26 PipelineStatusNotification::PipelineStatusNotification() |
25 : cv_(&lock_), status_(PIPELINE_OK), notified_(false) { | 27 : cv_(&lock_), status_(PIPELINE_OK), notified_(false) { |
26 callback_.reset(NewCallback(this, &PipelineStatusNotification::Notify)); | 28 callback_.reset(NewCallback(this, &PipelineStatusNotification::Notify)); |
27 } | 29 } |
28 | 30 |
29 PipelineStatusNotification::~PipelineStatusNotification() { | 31 PipelineStatusNotification::~PipelineStatusNotification() { |
30 DCHECK(notified_); | 32 DCHECK(notified_); |
31 } | 33 } |
32 | 34 |
33 media::PipelineStatusCallback* PipelineStatusNotification::Callback() { | 35 media::PipelineStatusCallback* PipelineStatusNotification::Callback() { |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 DCHECK_EQ(kCreated, state_); | 612 DCHECK_EQ(kCreated, state_); |
611 filter_collection_.reset(filter_collection); | 613 filter_collection_.reset(filter_collection); |
612 url_ = url; | 614 url_ = url; |
613 seek_callback_.reset(start_callback); | 615 seek_callback_.reset(start_callback); |
614 | 616 |
615 // Kick off initialization. | 617 // Kick off initialization. |
616 pipeline_init_state_.reset(new PipelineInitState()); | 618 pipeline_init_state_.reset(new PipelineInitState()); |
617 pipeline_init_state_->composite_ = new CompositeFilter(message_loop_); | 619 pipeline_init_state_->composite_ = new CompositeFilter(message_loop_); |
618 pipeline_init_state_->composite_->set_host(this); | 620 pipeline_init_state_->composite_->set_host(this); |
619 | 621 |
620 if (RTCVideoDecoder::IsUrlSupported(url)) { | 622 bool raw_media = (base::strncasecmp(url.c_str(), kRawMediaScheme, |
| 623 strlen(kRawMediaScheme)) == 0); |
| 624 if (raw_media) { |
621 set_state(kInitVideoDecoder); | 625 set_state(kInitVideoDecoder); |
622 InitializeVideoDecoder(NULL); | 626 InitializeVideoDecoder(NULL); |
623 } else { | 627 } else { |
624 set_state(kInitDemuxer); | 628 set_state(kInitDemuxer); |
625 InitializeDemuxer(); | 629 InitializeDemuxer(); |
626 } | 630 } |
627 } | 631 } |
628 | 632 |
629 // Main initialization method called on the pipeline thread. This code attempts | 633 // Main initialization method called on the pipeline thread. This code attempts |
630 // to use the specified filter factory to build a pipeline. | 634 // 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: | 1304 case kStopping: |
1301 case kStopped: | 1305 case kStopped: |
1302 NOTREACHED() << "Unexpected state for teardown: " << state_; | 1306 NOTREACHED() << "Unexpected state for teardown: " << state_; |
1303 break; | 1307 break; |
1304 // default: intentionally left out to force new states to cause compiler | 1308 // default: intentionally left out to force new states to cause compiler |
1305 // errors. | 1309 // errors. |
1306 }; | 1310 }; |
1307 } | 1311 } |
1308 | 1312 |
1309 } // namespace media | 1313 } // namespace media |
OLD | NEW |