OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/cast/video_receiver/video_receiver.h" | 5 #include "media/cast/video_receiver/video_receiver.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 video_decoder_.reset(new VideoDecoder(cast_environment, video_config)); | 63 video_decoder_.reset(new VideoDecoder(cast_environment, video_config)); |
64 } | 64 } |
65 decryptor_.Initialize(video_config.aes_key, video_config.aes_iv_mask); | 65 decryptor_.Initialize(video_config.aes_key, video_config.aes_iv_mask); |
66 rtcp_.SetTargetDelay(target_delay_delta_); | 66 rtcp_.SetTargetDelay(target_delay_delta_); |
67 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_); | 67 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_); |
68 memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_)); | 68 memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_)); |
69 } | 69 } |
70 | 70 |
71 VideoReceiver::~VideoReceiver() { | 71 VideoReceiver::~VideoReceiver() { |
72 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 72 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
73 | |
74 // If any callbacks for encoded video frames are queued, flush them out now. | |
miu
2014/04/09 19:44:35
The comment in video_receiver.h (starting at line
hubbe
2014/04/09 20:39:43
Done.
| |
75 // This is critical because some Closures in |frame_request_queue_| may have | |
76 // Unretained references to |this|. | |
77 while (!frame_request_queue_.empty()) { | |
78 frame_request_queue_.front().Run( | |
79 make_scoped_ptr<transport::EncodedVideoFrame>(NULL), base::TimeTicks()); | |
80 frame_request_queue_.pop_front(); | |
81 } | |
82 | |
83 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber_); | 73 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber_); |
84 } | 74 } |
85 | 75 |
86 void VideoReceiver::InitializeTimers() { | 76 void VideoReceiver::InitializeTimers() { |
87 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 77 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
88 ScheduleNextRtcpReport(); | 78 ScheduleNextRtcpReport(); |
89 ScheduleNextCastMessage(); | 79 ScheduleNextCastMessage(); |
90 } | 80 } |
91 | 81 |
92 void VideoReceiver::GetRawVideoFrame( | 82 void VideoReceiver::GetRawVideoFrame( |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 } | 414 } |
425 | 415 |
426 void VideoReceiver::SendNextRtcpReport() { | 416 void VideoReceiver::SendNextRtcpReport() { |
427 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 417 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
428 rtcp_.SendRtcpFromRtpReceiver(NULL, NULL); | 418 rtcp_.SendRtcpFromRtpReceiver(NULL, NULL); |
429 ScheduleNextRtcpReport(); | 419 ScheduleNextRtcpReport(); |
430 } | 420 } |
431 | 421 |
432 } // namespace cast | 422 } // namespace cast |
433 } // namespace media | 423 } // namespace media |
OLD | NEW |