OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2011 Ericsson AB. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 MediaStreamComponent* component) | 65 MediaStreamComponent* component) |
66 : ContextLifecycleObserver(context), | 66 : ContextLifecycleObserver(context), |
67 ready_state_(MediaStreamSource::kReadyStateLive), | 67 ready_state_(MediaStreamSource::kReadyStateLive), |
68 is_iterating_registered_media_streams_(false), | 68 is_iterating_registered_media_streams_(false), |
69 stopped_(false), | 69 stopped_(false), |
70 component_(component), | 70 component_(component), |
71 // The source's constraints aren't yet initialized at creation time. | 71 // The source's constraints aren't yet initialized at creation time. |
72 constraints_() { | 72 constraints_() { |
73 component_->Source()->AddObserver(this); | 73 component_->Source()->AddObserver(this); |
74 | 74 |
75 // If the source is already non-live at this point, the observer won't have | |
76 // been called. Check the state manually. | |
77 if (ready_state_ != component_->Source()->GetReadyState()) | |
78 SourceChangedState(); | |
Max Morin
2017/06/02 09:56:05
You seem to be calling a virtual method from the c
ossu-chromium
2017/06/02 10:48:00
You're right. I actually only need to add a check
| |
79 | |
75 if (component_->Source() && | 80 if (component_->Source() && |
76 component_->Source()->GetType() == MediaStreamSource::kTypeVideo) { | 81 component_->Source()->GetType() == MediaStreamSource::kTypeVideo) { |
77 // ImageCapture::create() only throws if |this| track is not of video type. | 82 // ImageCapture::create() only throws if |this| track is not of video type. |
78 NonThrowableExceptionState exception_state; | 83 NonThrowableExceptionState exception_state; |
79 image_capture_ = ImageCapture::Create(context, this, exception_state); | 84 image_capture_ = ImageCapture::Create(context, this, exception_state); |
80 } | 85 } |
81 } | 86 } |
82 | 87 |
83 MediaStreamTrack::~MediaStreamTrack() {} | 88 MediaStreamTrack::~MediaStreamTrack() {} |
84 | 89 |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 | 414 |
410 DEFINE_TRACE(MediaStreamTrack) { | 415 DEFINE_TRACE(MediaStreamTrack) { |
411 visitor->Trace(registered_media_streams_); | 416 visitor->Trace(registered_media_streams_); |
412 visitor->Trace(component_); | 417 visitor->Trace(component_); |
413 visitor->Trace(image_capture_); | 418 visitor->Trace(image_capture_); |
414 EventTargetWithInlineData::Trace(visitor); | 419 EventTargetWithInlineData::Trace(visitor); |
415 ContextLifecycleObserver::Trace(visitor); | 420 ContextLifecycleObserver::Trace(visitor); |
416 } | 421 } |
417 | 422 |
418 } // namespace blink | 423 } // namespace blink |
OLD | NEW |