OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/video/video_receive_stream.h" | 11 #include "webrtc/video/video_receive_stream.h" |
12 | 12 |
13 #include <stdlib.h> | 13 #include <stdlib.h> |
14 | 14 |
15 #include <set> | 15 #include <set> |
16 #include <string> | 16 #include <string> |
17 #include <utility> | 17 #include <utility> |
18 | 18 |
19 #include "webrtc/base/checks.h" | 19 #include "webrtc/base/checks.h" |
20 #include "webrtc/base/location.h" | 20 #include "webrtc/base/location.h" |
21 #include "webrtc/base/logging.h" | 21 #include "webrtc/base/logging.h" |
22 #include "webrtc/base/optional.h" | 22 #include "webrtc/base/optional.h" |
| 23 #include "webrtc/base/trace_event.h" |
23 #include "webrtc/common_video/h264/profile_level_id.h" | 24 #include "webrtc/common_video/h264/profile_level_id.h" |
24 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 25 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
25 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" | 26 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" |
26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
27 #include "webrtc/modules/utility/include/process_thread.h" | 28 #include "webrtc/modules/utility/include/process_thread.h" |
28 #include "webrtc/modules/video_coding/frame_object.h" | 29 #include "webrtc/modules/video_coding/frame_object.h" |
29 #include "webrtc/modules/video_coding/include/video_coding.h" | 30 #include "webrtc/modules/video_coding/include/video_coding.h" |
30 #include "webrtc/modules/video_coding/jitter_estimator.h" | 31 #include "webrtc/modules/video_coding/jitter_estimator.h" |
31 #include "webrtc/modules/video_coding/timing.h" | 32 #include "webrtc/modules/video_coding/timing.h" |
32 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" | 33 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 void VideoReceiveStream::SetMinimumPlayoutDelay(int delay_ms) { | 467 void VideoReceiveStream::SetMinimumPlayoutDelay(int delay_ms) { |
467 RTC_DCHECK_RUN_ON(&module_process_thread_checker_); | 468 RTC_DCHECK_RUN_ON(&module_process_thread_checker_); |
468 video_receiver_.SetMinimumPlayoutDelay(delay_ms); | 469 video_receiver_.SetMinimumPlayoutDelay(delay_ms); |
469 } | 470 } |
470 | 471 |
471 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) { | 472 bool VideoReceiveStream::DecodeThreadFunction(void* ptr) { |
472 return static_cast<VideoReceiveStream*>(ptr)->Decode(); | 473 return static_cast<VideoReceiveStream*>(ptr)->Decode(); |
473 } | 474 } |
474 | 475 |
475 bool VideoReceiveStream::Decode() { | 476 bool VideoReceiveStream::Decode() { |
| 477 TRACE_EVENT0("webrtc", "VideoReceiveStream::Decode"); |
476 static const int kMaxWaitForFrameMs = 3000; | 478 static const int kMaxWaitForFrameMs = 3000; |
477 std::unique_ptr<video_coding::FrameObject> frame; | 479 std::unique_ptr<video_coding::FrameObject> frame; |
478 video_coding::FrameBuffer::ReturnReason res = | 480 video_coding::FrameBuffer::ReturnReason res = |
479 frame_buffer_->NextFrame(kMaxWaitForFrameMs, &frame); | 481 frame_buffer_->NextFrame(kMaxWaitForFrameMs, &frame); |
480 | 482 |
481 if (res == video_coding::FrameBuffer::ReturnReason::kStopped) | 483 if (res == video_coding::FrameBuffer::ReturnReason::kStopped) |
482 return false; | 484 return false; |
483 | 485 |
484 if (frame) { | 486 if (frame) { |
485 if (video_receiver_.Decode(frame.get()) == VCM_OK) | 487 if (video_receiver_.Decode(frame.get()) == VCM_OK) |
486 rtp_stream_receiver_.FrameDecoded(frame->picture_id); | 488 rtp_stream_receiver_.FrameDecoded(frame->picture_id); |
487 } else { | 489 } else { |
488 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs | 490 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs |
489 << " ms, requesting keyframe."; | 491 << " ms, requesting keyframe."; |
490 RequestKeyFrame(); | 492 RequestKeyFrame(); |
491 } | 493 } |
492 return true; | 494 return true; |
493 } | 495 } |
494 } // namespace internal | 496 } // namespace internal |
495 } // namespace webrtc | 497 } // namespace webrtc |
OLD | NEW |