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/base/trace_event.h" |
24 #include "webrtc/common_types.h" | |
24 #include "webrtc/common_video/h264/profile_level_id.h" | 25 #include "webrtc/common_video/h264/profile_level_id.h" |
25 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 26 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
26 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" | 27 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" |
27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 28 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
28 #include "webrtc/modules/utility/include/process_thread.h" | 29 #include "webrtc/modules/utility/include/process_thread.h" |
29 #include "webrtc/modules/video_coding/frame_object.h" | 30 #include "webrtc/modules/video_coding/frame_object.h" |
30 #include "webrtc/modules/video_coding/include/video_coding.h" | 31 #include "webrtc/modules/video_coding/include/video_coding.h" |
31 #include "webrtc/modules/video_coding/jitter_estimator.h" | 32 #include "webrtc/modules/video_coding/jitter_estimator.h" |
32 #include "webrtc/modules/video_coding/timing.h" | 33 #include "webrtc/modules/video_coding/timing.h" |
33 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" | 34 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 return ss.str(); | 136 return ss.str(); |
136 } | 137 } |
137 | 138 |
138 namespace { | 139 namespace { |
139 VideoCodec CreateDecoderVideoCodec(const VideoReceiveStream::Decoder& decoder) { | 140 VideoCodec CreateDecoderVideoCodec(const VideoReceiveStream::Decoder& decoder) { |
140 VideoCodec codec; | 141 VideoCodec codec; |
141 memset(&codec, 0, sizeof(codec)); | 142 memset(&codec, 0, sizeof(codec)); |
142 | 143 |
143 codec.plType = decoder.payload_type; | 144 codec.plType = decoder.payload_type; |
144 strncpy(codec.plName, decoder.payload_name.c_str(), sizeof(codec.plName)); | 145 strncpy(codec.plName, decoder.payload_name.c_str(), sizeof(codec.plName)); |
145 if (decoder.payload_name == "VP8") { | 146 // Convert codec name to enum type, using kVideoCodecGeneric if it's not |
146 codec.codecType = kVideoCodecVP8; | 147 // recognized. |
147 } else if (decoder.payload_name == "VP9") { | 148 rtc::Optional<VideoCodecType> codecType = |
148 codec.codecType = kVideoCodecVP9; | 149 PayloadNameToCodecType(decoder.payload_name); |
149 } else if (decoder.payload_name == "H264") { | 150 codec.codecType = codecType ? *codecType : kVideoCodecGeneric; |
sprang_webrtc
2017/03/30 08:14:47
You can simplify this to
codec.codecType = Payload
Taylor Brandstetter
2017/03/30 17:04:33
Forgot about that; done.
| |
150 codec.codecType = kVideoCodecH264; | |
151 } else { | |
152 codec.codecType = kVideoCodecGeneric; | |
153 } | |
154 | 151 |
155 if (codec.codecType == kVideoCodecVP8) { | 152 if (codec.codecType == kVideoCodecVP8) { |
156 *(codec.VP8()) = VideoEncoder::GetDefaultVp8Settings(); | 153 *(codec.VP8()) = VideoEncoder::GetDefaultVp8Settings(); |
157 } else if (codec.codecType == kVideoCodecVP9) { | 154 } else if (codec.codecType == kVideoCodecVP9) { |
158 *(codec.VP9()) = VideoEncoder::GetDefaultVp9Settings(); | 155 *(codec.VP9()) = VideoEncoder::GetDefaultVp9Settings(); |
159 } else if (codec.codecType == kVideoCodecH264) { | 156 } else if (codec.codecType == kVideoCodecH264) { |
160 *(codec.H264()) = VideoEncoder::GetDefaultH264Settings(); | 157 *(codec.H264()) = VideoEncoder::GetDefaultH264Settings(); |
161 codec.H264()->profile = | 158 codec.H264()->profile = |
162 H264::ParseSdpProfileLevelId(decoder.codec_params)->profile; | 159 H264::ParseSdpProfileLevelId(decoder.codec_params)->profile; |
163 } | 160 } |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 rtp_stream_receiver_.FrameDecoded(frame->picture_id); | 488 rtp_stream_receiver_.FrameDecoded(frame->picture_id); |
492 } else { | 489 } else { |
493 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs | 490 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs |
494 << " ms, requesting keyframe."; | 491 << " ms, requesting keyframe."; |
495 RequestKeyFrame(); | 492 RequestKeyFrame(); |
496 } | 493 } |
497 return true; | 494 return true; |
498 } | 495 } |
499 } // namespace internal | 496 } // namespace internal |
500 } // namespace webrtc | 497 } // namespace webrtc |
OLD | NEW |