| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2  *  Copyright (c) 2014 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 | 
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 145         count_(0), | 145         count_(0), | 
| 146         last_width_(0), | 146         last_width_(0), | 
| 147         last_height_(0) {} | 147         last_height_(0) {} | 
| 148 | 148 | 
| 149   ~FileRenderPassthrough() { | 149   ~FileRenderPassthrough() { | 
| 150     if (file_ != nullptr) | 150     if (file_ != nullptr) | 
| 151       fclose(file_); | 151       fclose(file_); | 
| 152   } | 152   } | 
| 153 | 153 | 
| 154  private: | 154  private: | 
| 155   void RenderFrame(const VideoFrame& video_frame, | 155   void OnFrame(const VideoFrame& video_frame) override { | 
| 156                    int time_to_render_ms) override { |  | 
| 157     if (renderer_ != nullptr) | 156     if (renderer_ != nullptr) | 
| 158       renderer_->RenderFrame(video_frame, time_to_render_ms); | 157       renderer_->OnFrame(video_frame); | 
| 159     if (basename_.empty()) | 158     if (basename_.empty()) | 
| 160       return; | 159       return; | 
| 161     if (last_width_ != video_frame.width() || | 160     if (last_width_ != video_frame.width() || | 
| 162         last_height_ != video_frame.height()) { | 161         last_height_ != video_frame.height()) { | 
| 163       if (file_ != nullptr) | 162       if (file_ != nullptr) | 
| 164         fclose(file_); | 163         fclose(file_); | 
| 165       std::stringstream filename; | 164       std::stringstream filename; | 
| 166       filename << basename_; | 165       filename << basename_; | 
| 167       if (++count_ > 1) | 166       if (++count_ > 1) | 
| 168         filename << '-' << count_; | 167         filename << '-' << count_; | 
| 169       filename << '_' << video_frame.width() << 'x' << video_frame.height() | 168       filename << '_' << video_frame.width() << 'x' << video_frame.height() | 
| 170                << ".yuv"; | 169                << ".yuv"; | 
| 171       file_ = fopen(filename.str().c_str(), "wb"); | 170       file_ = fopen(filename.str().c_str(), "wb"); | 
| 172       if (file_ == nullptr) { | 171       if (file_ == nullptr) { | 
| 173         fprintf(stderr, | 172         fprintf(stderr, | 
| 174                 "Couldn't open file for writing: %s\n", | 173                 "Couldn't open file for writing: %s\n", | 
| 175                 filename.str().c_str()); | 174                 filename.str().c_str()); | 
| 176       } | 175       } | 
| 177     } | 176     } | 
| 178     last_width_ = video_frame.width(); | 177     last_width_ = video_frame.width(); | 
| 179     last_height_ = video_frame.height(); | 178     last_height_ = video_frame.height(); | 
| 180     if (file_ == nullptr) | 179     if (file_ == nullptr) | 
| 181       return; | 180       return; | 
| 182     PrintVideoFrame(video_frame, file_); | 181     PrintVideoFrame(video_frame, file_); | 
| 183   } | 182   } | 
| 184 | 183 | 
| 185   bool IsTextureSupported() const override { return false; } |  | 
| 186 |  | 
| 187   const std::string basename_; | 184   const std::string basename_; | 
| 188   VideoRenderer* const renderer_; | 185   VideoRenderer* const renderer_; | 
| 189   FILE* file_; | 186   FILE* file_; | 
| 190   size_t count_; | 187   size_t count_; | 
| 191   int last_width_; | 188   int last_width_; | 
| 192   int last_height_; | 189   int last_height_; | 
| 193 }; | 190 }; | 
| 194 | 191 | 
| 195 class DecoderBitstreamFileWriter : public EncodedFrameObserver { | 192 class DecoderBitstreamFileWriter : public EncodedFrameObserver { | 
| 196  public: | 193  public: | 
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 321 } | 318 } | 
| 322 }  // namespace webrtc | 319 }  // namespace webrtc | 
| 323 | 320 | 
| 324 int main(int argc, char* argv[]) { | 321 int main(int argc, char* argv[]) { | 
| 325   ::testing::InitGoogleTest(&argc, argv); | 322   ::testing::InitGoogleTest(&argc, argv); | 
| 326   google::ParseCommandLineFlags(&argc, &argv, true); | 323   google::ParseCommandLineFlags(&argc, &argv, true); | 
| 327 | 324 | 
| 328   webrtc::test::RunTest(webrtc::RtpReplay); | 325   webrtc::test::RunTest(webrtc::RtpReplay); | 
| 329   return 0; | 326   return 0; | 
| 330 } | 327 } | 
| OLD | NEW | 
|---|