| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/android/webaudio_media_codec_bridge.h" | 5 #include "media/base/android/webaudio_media_codec_bridge.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 int WebAudioMediaCodecBridge::SaveEncodedAudioToFile( | 56 int WebAudioMediaCodecBridge::SaveEncodedAudioToFile( |
| 57 JNIEnv* env, | 57 JNIEnv* env, |
| 58 jobject context) { | 58 jobject context) { |
| 59 // Create a temporary file where we can save the encoded audio data. | 59 // Create a temporary file where we can save the encoded audio data. |
| 60 std::string temporaryFile = | 60 std::string temporaryFile = |
| 61 base::android::ConvertJavaStringToUTF8( | 61 base::android::ConvertJavaStringToUTF8( |
| 62 env, | 62 env, |
| 63 Java_WebAudioMediaCodecBridge_CreateTempFile(env, context).obj()); | 63 Java_WebAudioMediaCodecBridge_createTempFile(env, context).obj()); |
| 64 | 64 |
| 65 // Open the file and unlink it, so that it will be actually removed | 65 // Open the file and unlink it, so that it will be actually removed |
| 66 // when we close the file. | 66 // when we close the file. |
| 67 int fd = open(temporaryFile.c_str(), O_RDWR); | 67 int fd = open(temporaryFile.c_str(), O_RDWR); |
| 68 if (unlink(temporaryFile.c_str())) { | 68 if (unlink(temporaryFile.c_str())) { |
| 69 VLOG(0) << "Couldn't unlink temp file " << temporaryFile | 69 VLOG(0) << "Couldn't unlink temp file " << temporaryFile |
| 70 << ": " << strerror(errno); | 70 << ": " << strerror(errno); |
| 71 } | 71 } |
| 72 | 72 |
| 73 if (fd < 0) { | 73 if (fd < 0) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 count -= bytes_written; | 190 count -= bytes_written; |
| 191 buffer += bytes_written; | 191 buffer += bytes_written; |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 | 194 |
| 195 bool WebAudioMediaCodecBridge::RegisterWebAudioMediaCodecBridge(JNIEnv* env) { | 195 bool WebAudioMediaCodecBridge::RegisterWebAudioMediaCodecBridge(JNIEnv* env) { |
| 196 return RegisterNativesImpl(env); | 196 return RegisterNativesImpl(env); |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace | 199 } // namespace |
| OLD | NEW |