Voice data acquisition and transmission method and terminal based on embedded RTOS

By collecting and transmitting voice data on an embedded RTOS terminal, using the characteristics of RAM and flash queues, the problems of complex real-time transmission of voice data and large resource occupancy are solved, real-time reliable transmission of voice data and efficient utilization of memory are achieved.

CN118921357APending Publication Date: 2024-11-08FUJIAN HUIJIETONG TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411018305.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

The prior art is complex in real-time transmission of voice data and takes up a large resource. Especially in small embedded terminals with limited resources, it is difficult to ensure the real-time reliability of voice data, especially when the network environment is poor.

Method used

Using the voice data acquisition and transmission method based on embedded RTOS, PCM audio data is collected in real time and compressed and stored in cache RAM. After judging that the storage is full, the data is written to the flash queue and the RAM is released to ensure data integrity and through Flash queues are uploaded to cloud servers, implementing secondary caching to reduce memory usage.

Benefits of technology

It improves the real-time reliability of voice data acquisition and transmission in embedded operating systems, ensures data integrity and reduces memory usage, and is suitable for embedded terminals with limited resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118921357A_ABST
    Figure CN118921357A_ABST
Patent Text Reader

Abstract

According to the voice data acquisition and transmission method based on the embedded RTOS and the terminal provided by the invention, PCM audio data acquired in real time is compressed and stored in the cache RAM by utilizing the characteristic of fast data writing of the RAM, and primary caching is carried out; then the compressed data fully stored in the high-speed cache RAM is stored in a flash memory queue by utilizing the characteristic that the flash memory is not lost during power failure, and second-level caching is carried out, so that the integrity of the voice data is ensured; meanwhile, the high-speed cache RAM can be released after the second-level cache so as to be reused, so that the memory occupation of the embedded implementation operation system is effectively reduced; and finally, the data of the flash memory queue is uploaded to a cloud server, so that the real-time reliability of voice data acquisition and transmission in the embedded implementation operation system is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a voice data collection and transmission method and a terminal based on embedded RTOS. Background Art

[0002] When voice is transmitted in real time, the usual practice is to use a real-time transport protocol such as RTP (Real-time Transport Protocol) to send voice data, or to cache the data in a high-speed cache while transmitting it.

[0003] The real-time transport protocol stack RTP usually needs to be combined with other protocols to achieve real-time transmission of voice data. It is not only complex to implement but also requires more memory resources (including code space and RAM space). The method of caching to cache while transmitting also takes up a lot of cache space when the network environment is not good, and if the user shuts down the machine, the voice data will be lost. Therefore, these two methods are not suitable for small embedded terminals with limited resources.

[0004] At the same time, voice data can be lost or transmitted unreliably in some application scenarios. For example, in order to ensure the smoothness of video calls, lost voice data can be ignored. However, in the application scenarios of some acquisition systems, the loss of voice data will cause playback abnormalities and affect the experience. Therefore, how to ensure the real-time reliability of voice data acquisition and transmission has gradually become a technical problem that needs to be solved urgently. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a voice data collection and transmission method and terminal based on embedded RTOS, so as to effectively improve the real-time reliability of voice data collection and transmission in the embedded operating system.

[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0007] A voice data collection and transmission method based on embedded RTOS, comprising the steps of:

[0008] S1, collect PCM audio data in real time, compress it and store it in the cache RAM;

[0009] S2, determining whether the cache RAM is full, and if so, initiating a write request to the flash memory queue;

[0010] S3, the flash memory queue stores the compressed data in the cache RAM and releases the cache RAM;

[0011] S4. Upload the compressed data stored in the flash queue to a cloud server.

[0012] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0013] A voice data acquisition and transmission terminal based on an embedded RTOS comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the above-mentioned voice data acquisition and transmission method based on the embedded RTOS are implemented.

[0014] The beneficial effects of the present invention are as follows: providing a voice data collection and transmission method and terminal based on an embedded RTOS, compressing and storing PCM audio data collected in real time in a high-speed cache RAM by utilizing the fast data writing characteristic of RAM, and performing first-level cache; then utilizing the non-loss characteristic of flash memory when power is off to store the compressed data fully stored in the high-speed cache RAM in a flash memory queue, and performing second-level cache to ensure the integrity of the voice data; at the same time, the cache RAM can be released after the second-level cache for reuse, and the memory occupancy of the embedded operating system is effectively reduced; finally, the data in the flash memory queue is uploaded to a cloud server, thereby effectively improving the real-time reliability of the collection and transmission of voice data in the embedded operating system. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 The present invention is an overall flow chart of a method for voice data collection and transmission based on embedded RTOS according to an embodiment of the present invention;

[0016] Figure 2 A processing flow chart of a high-speed cache RAM in a voice data collection and transmission method based on an embedded RTOS according to an embodiment of the present invention;

[0017] Figure 3 A processing flow chart of a secondary file storage module in a voice data collection and transmission method based on an embedded RTOS according to an embodiment of the present invention;

[0018] Figure 4 A processing flow chart of an upload module in a voice data collection and transmission method based on an embedded RTOS according to an embodiment of the present invention;

[0019] Figure 5 The present invention is a schematic diagram of the structure of a voice data acquisition and transmission terminal based on an embedded RTOS according to an embodiment of the present invention.

[0020] Description of labels:

[0021] 1. A voice data acquisition and transmission terminal based on embedded RTOS; 2. Memory; 3. Processor. DETAILED DESCRIPTION

[0022] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.

[0023] Prior to this, the English terms that appear in this article are explained as follows:

[0024] RTOS: Embedded Real-time Operation System, an embedded real-time operating system, is an embedded operating system that can accept and process external events or data at a fast enough speed when they are generated, and the processing results can control the production process or respond quickly to the processing system within the specified time, and control all real-time tasks to run in a coordinated and consistent manner.

[0025] Device SN: Serial Number, which is the product serial number, is usually used to identify and track individual products. In device manufacturing, SN usually represents the unique number or identity identifier of the device.

[0026] PCM audio data: PCM, Pulse Code Modulation, is also known as pulse code modulation. PCM audio data is an uncompressed audio sampling data stream. It is a standard digital audio data converted from an analog signal through sampling, quantization, and encoding.

[0027] Please refer to Figures 1 to 4 , a voice data collection and transmission method based on embedded RTOS, comprising the steps of:

[0028] S1, collect PCM audio data in real time, compress it and store it in the cache RAM;

[0029] S2, determining whether the cache RAM is full, and if so, initiating a write request to the flash memory queue;

[0030] S3, the flash memory queue stores the compressed data in the cache RAM and releases the cache RAM;

[0031] S4. Upload the compressed data stored in the flash queue to a cloud server.

[0032] From the above description, it can be seen that the beneficial effects of the present invention are: providing a voice data collection and transmission method based on an embedded RTOS, by utilizing the fast data writing characteristic of RAM, compressing the real-time collected PCM audio data and storing it in the cache RAM for first-level caching; then utilizing the non-loss characteristic of the flash memory when power is off to store the compressed data fully stored in the cache RAM into the flash memory queue for second-level caching to ensure the integrity of the voice data; at the same time, the cache RAM can be released after the second-level caching for reuse, effectively reducing the memory occupancy of the embedded operating system; finally, the data in the flash memory queue is uploaded to the cloud server, thereby effectively improving the real-time reliability of the collection and transmission of voice data in the embedded operating system.

[0033] Furthermore, the step S1 also includes:

[0034] A unique data ID is bound to each compressed PCM audio data, and the data ID includes a device SN, a timestamp and a four-byte data index Index.

[0035] From the above description, it can be seen that in order to ensure the uniqueness and orderliness of voice data, a data ID consisting of device SN+timestamp+four-byte data index Indes is bound to each compressed PCM audio data, where device SM ensures the uniqueness of different devices, that is, the uniqueness of voice data collected from different devices, the timestamp ensures that each recording is different and ordered, and Index means that a recording is accumulated from 0000 in chronological order. Such a data ID can make the voice data of the same device in order from old to new, that is, the PCM audio data is in order from old to new.

[0036] Furthermore, the step S1 is specifically as follows:

[0037] S11, applying for a cache RAM with a memory of a first threshold;

[0038] S12, collecting PCM audio data in real time through the embedded processor collection interface, and compressing and storing the data in the cache RAM in units of single frames.

[0039] Furthermore, the step S2 is specifically as follows:

[0040] S21, determining whether the compressed data cached in the cache RAM reaches the first threshold, and if so, creating a first-level queue node for the compressed data, and binding cache information to the compressed data, the cache information including a cache address, valid data length information and the data ID;

[0041] S22, inserting the first-level queue node into the latest node of the first-level cache queue, and initiating a write request to a second-level file cache module, wherein the second-level file cache module includes a flash memory system and a flash memory queue;

[0042] S23, apply for a new cache RAM, and repeat steps S1 to S22.

[0043] From the above description, it can be seen that when the current cache RAM is full, in order to improve the real-time collection and writing efficiency of voice data, a new cache RAM can be created to perform the first-level storage of new PCM audio data. After the data in the subsequent full cache RAM is cached at the second level and the cache RAM is released again, the cache RAM after the memory is released can be reused, that is, there is no need to wait for the old cache RAM to be released before performing the first-level cache, which effectively improves the efficiency. In addition, the memory applied for by the newly created cache RAM can be consistent with the memory in the old cache RAM, or different. At the same time, a unique data ID, cache address and valid data length information are bound to each compressed data that has been cached at the first level, so that the subsequent second-level cache addressing can obtain the compressed data content, further improving the writing efficiency and real-time reliability of voice data.

[0044] Furthermore, before step S1, the following steps are also included:

[0045] S0. Initialize the secondary file cache module and create a flash memory queue.

[0046] Furthermore, the step S3 is specifically as follows:

[0047] S31, the flash memory system receives the write request, takes out the oldest first-level queue node in the first-level cache queue, and creates a flash memory file with the data ID corresponding to the oldest first-level queue node in the first-level cache queue as the file name;

[0048] S32, the flash memory system obtains the compressed data stored in the corresponding cache RAM using the cache address and the valid data length information corresponding to the oldest first-level queue node in the first-level cache queue and writes it into the flash memory file. After the compressed file is written, the corresponding cache RAM is released and an upload request is initiated to the upload module.

[0049] Furthermore, the step S3 also includes:

[0050] The flash memory queue retrieves its own file storage directory, and sorts the retrieved file names, and creates a corresponding secondary queue node for each of the sorted flash memory files.

[0051] From the above description, it can be seen that creating a file for secondary caching with the data ID as the file name facilitates the flash queue to be sorted according to the data ID, and then facilitates the generation of secondary queue nodes, ensuring the orderliness and integrity of the voice data, and improving the efficiency of subsequently uploading the voice data to the cloud server.

[0052] Furthermore, the step S4 is specifically as follows:

[0053] S41, the upload module determines whether the upload request is received or the scheduled upload time is reached, and if so, extracts the flash files in the flash queue in sequence according to the secondary queue nodes through the HTTP protocol and uploads them to the cloud server;

[0054] S42: The upload module notifies the flash memory system to delete the flash memory file in the flash memory queue that has been uploaded.

[0055] Furthermore, the step S4 also includes:

[0056] When the flash memory file fails to be uploaded, the flash memory file that failed to be uploaded is stored in the flash memory queue again, and the flash memory queue is re-sorted according to the file name and then the secondary queue node is updated.

[0057] From the above description, it can be seen that the upload module uses two judgment methods to perform real-time uploading of voice data, one is receiving an upload request, and the other is scheduled uploading, to ensure that after the upload file fails, the failed data can be re-uploaded, avoiding the loss of voice data, ensuring the integrity of voice data, and further effectively improving the real-time reliability of voice data writing.

[0058] Please refer to Figure 5 A voice data acquisition and transmission terminal based on an embedded RTOS comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the voice data acquisition and transmission method based on an embedded RTOS are implemented.

[0059] From the above description, it can be seen that the beneficial effects of the present invention are: based on the same technical concept, in conjunction with the above-mentioned voice data acquisition and transmission method based on embedded RTOS, a voice data acquisition and transmission terminal based on embedded RTOS is provided, and by utilizing the fast data writing characteristic of RAM, the real-time collected PCM audio data is compressed and stored in the cache RAM for first-level caching; then, the non-loss characteristic of flash memory during power failure is utilized to store the compressed data fully stored in the cache RAM into the flash memory queue for second-level caching to ensure the integrity of the voice data; at the same time, the cache RAM can be released after the second-level caching for reuse, effectively reducing the memory occupancy of the embedded operating system; finally, the data in the flash memory queue is uploaded to the cloud server, thereby effectively improving the real-time reliability of voice data acquisition and transmission in the embedded operating system.

[0060] The present invention provides a voice data collection and transmission method and terminal based on embedded RTOS, which are mainly used in the scenario of uploading the generated voice data to the cloud in real time after recording in an embedded real-time operating system. The following is a specific description in conjunction with a specific embodiment:

[0061] Please refer to Figure 1 , Embodiment 1 of the present invention is:

[0062] A voice data acquisition and transmission method based on embedded RTOS, such as Figure 1 As shown, the steps include:

[0063] S1. Collect PCM audio data in real time, bind a unique data ID to each compressed PCM audio data, and store it in the cache RAM after compression, where the data ID includes the device SN, timestamp and four-byte data index Index.

[0064] S2. Determine whether the cache RAM is full, and if so, initiate a write request to the flash memory queue.

[0065] S3. The flash queue stores the compressed data in the cache RAM and releases the cache RAM.

[0066] S4. Upload the compressed data stored in the flash queue to the cloud server.

[0067] That is, in this embodiment, by utilizing the fast data writing feature of RAM, the PCM audio data collected in real time is compressed and stored in the cache RAM for first-level caching; then the power-off non-loss feature of the flash memory is utilized to store the compressed data stored in the cache RAM in the flash memory queue for second-level caching to ensure the integrity of the voice data; at the same time, the cache RAM can be released after the second-level caching for reuse, effectively reducing the memory occupancy of the embedded implementation operating system; finally, the data in the flash memory queue is uploaded to the cloud server, thereby effectively improving the real-time reliability of the collection and transmission of voice data in the embedded implementation operating system. In order to ensure the uniqueness and orderliness of the voice data, a data ID consisting of device SN+timestamp+four-byte data index Indes is bound to each compressed PCM audio data, wherein the device SM ensures the uniqueness of different devices, that is, the uniqueness of the voice data collected from different devices, the timestamp ensures that each recording is different and orderly, and the Index indicates that the recording is accumulated from 0000 in chronological order, and such a data ID can make the voice data of the same device from old to new, that is, the PCM audio data is from old to new.

[0068] Please refer to Figures 2 to 4 , Embodiment 2 of the present invention is:

[0069] A method for voice data collection and transmission based on embedded RTOS, based on the above embodiment 1, in this embodiment, step S1 is specifically:

[0070] S11. Apply for a cache RAM with a memory size of a first threshold. In this embodiment, the first threshold may be set to 100 KB.

[0071] S12, collecting PCM audio data in real time through the embedded processor collection interface, and compressing and storing the data in the high-speed cache RAM in units of single frames.

[0072] If Figure 2 As shown, step S2 is specifically as follows:

[0073] S21. Determine whether the compressed data cached in the cache RAM reaches a first threshold. If so, create a first-level queue node for the compressed data and bind cache information to the compressed data. The cache information includes a cache address, valid data length information, and a data ID, which can be used for subsequent creation of a flash memory file name and data addressing for secondary storage.

[0074] S22, inserting the first-level queue node into the latest node of the first-level cache queue, and initiating a write request to the second-level file cache module, the second-level file cache module includes a flash memory system and a flash memory queue. In this embodiment, the flash memory system can be used to manage the writing, reading and deletion of voice data, i.e., compressed PCM audio data; the flash memory queue is used to store or sort the generated flash memory files.

[0075] S23. Apply for a new cache RAM and repeat steps S1 to S22. That is, when the old cache RAM is full and cannot continue to write the PCM audio data collected in real time, the first-level cache can be continued by creating a new cache RAM. There is no need to wait for the old cache RAM to be released before continuing the first-level cache operation, which effectively improves the real-time reliability of voice data collection and writing.

[0076] In addition, in this embodiment, the memory of the newly built cache RAM may be consistent with the memory in the old cache RAM, or may be different, which is not limited here.

[0077] Meanwhile, in this embodiment, before step S1, the following steps are also included:

[0078] S0. Initialize the secondary file cache module and create a flash queue.

[0079] If Figure 3 As shown, step S3 is specifically as follows:

[0080] S31. The flash memory system receives a write request, takes out the oldest level 1 queue node in the level 1 cache queue, and creates a flash memory file with the data ID corresponding to the oldest level 1 queue node in the level 1 cache queue as the file name.

[0081] S32. The flash memory system obtains the compressed data stored in the corresponding cache RAM using the cache address and valid data length information corresponding to the oldest first-level queue node in the first-level cache queue and writes it into the flash memory file. After the compressed file is written, the corresponding cache RAM is released and an upload request is initiated to the upload module.

[0082] Wherein, step S3 also includes:

[0083] The flash memory queue retrieves its own file storage directory, sorts the files according to the retrieved file names, and creates a corresponding secondary queue node for each sorted flash memory file.

[0084] That is, a file for secondary caching is created with the data ID as the file name, so that the flash queue can be sorted according to the data ID, and then the secondary queue node can be generated, ensuring the orderliness and integrity of the voice data and improving the efficiency of uploading the voice data to the cloud server later.

[0085] In this embodiment, Figure 4 As shown, step S4 is specifically as follows:

[0086] S41, the upload module determines whether an upload request is received or the scheduled upload time is reached. If so, the flash files in the flash queue are extracted in sequence according to the secondary queue nodes through the HTTP protocol and uploaded to the cloud server;

[0087] S42: The upload module notifies the flash memory system to delete the uploaded flash memory files in the flash memory queue.

[0088] In addition, in Figure 4 As shown, in this embodiment, step S4 also includes:

[0089] When the flash memory file fails to be uploaded, the flash memory file that failed to be uploaded is stored in the flash memory queue again, and the flash memory queue is re-sorted according to the file name and then the secondary queue node is updated.

[0090] That is, the upload module uses two judgment methods to perform real-time upload of voice data, one is to receive an upload request, and the other is to upload at a scheduled time, to ensure that the failed data can be uploaded again after the upload file fails, to avoid the loss of voice data, to ensure the integrity of voice data, and to further effectively improve the real-time reliability of voice data writing.

[0091] In addition, in this embodiment, since each compressed data has a corresponding data ID, whether in the primary storage or secondary storage process, the primary queue node and the secondary queue node are nodes with time sequence generated according to the data ID. Therefore, the collection, writing and uploading of voice files are actually carried out in sequence, which not only ensures the integrity of the voice data, but also ensures its sequence, thereby effectively realizing the real-time collection and reliable transmission of voice data.

[0092] Please refer to Figure 5 , Embodiment 3 of the present invention is:

[0093] A voice data acquisition and transmission terminal 1 based on an embedded RTOS comprises a memory 2, a processor 3 and a computer program stored in the memory 2 and executable on the processor 3. When the processor 3 executes the computer program, the steps of a voice data acquisition and transmission method based on an embedded RTOS in the above-mentioned embodiment 1 or embodiment 2 are completed.

[0094] In summary, the voice data collection and transmission method and terminal based on embedded RTOS provided by the present invention can effectively improve the real-time reliability of voice data collection and transmission in the embedded operating system.

[0095] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A voice data collection and transmission method based on embedded RTOS, characterized in that: Includes steps: S1, collect PCM audio data in real time, compress it and store it in the cache RAM; S2, determining whether the cache RAM is full, and if so, initiating a write request to the flash memory queue; S3, the flash memory queue stores the compressed data in the cache RAM and releases the cache RAM; S4. Upload the compressed data stored in the flash queue to a cloud server.

2. A voice data collection and transmission method based on embedded RTOS according to claim 1, characterized in that: The step S1 also includes: A unique data ID is bound to each compressed PCM audio data, and the data ID includes a device SN, a timestamp and a four-byte data index Index.

3. A voice data collection and transmission method based on embedded RTOS according to claim 2, characterized in that: The step S1 is specifically as follows: S11, applying for a cache RAM with a memory of a first threshold; S12, collecting PCM audio data in real time through the embedded processor collection interface, and compressing and storing the data in the cache RAM in units of single frames.

4. The method for voice data collection and transmission based on embedded RTOS according to claim 3, characterized in that: The step S2 is specifically as follows: S21, determining whether the compressed data cached in the cache RAM reaches the first threshold, and if so, creating a first-level queue node for the compressed data, and binding cache information to the compressed data, the cache information including a cache address, valid data length information and the data ID; S22, inserting the first-level queue node into the latest node of the first-level cache queue, and initiating a write request to a second-level file cache module, wherein the second-level file cache module includes a flash memory system and a flash memory queue; S23, apply for a new cache RAM, and repeat steps S1 to S22.

5. A method for collecting and transmitting voice data based on embedded RTOS according to claim 4, characterized in that: Before step S1, the following steps are also included: S0. Initialize the secondary file cache module and create a flash memory queue.

6. A voice data collection and transmission method based on embedded RTOS according to claim 5, characterized in that: The step S3 is specifically as follows: S31, the flash memory system receives the write request, takes out the oldest first-level queue node in the first-level cache queue, and creates a flash memory file with the data ID corresponding to the oldest first-level queue node in the first-level cache queue as the file name; S32, the flash memory system obtains the compressed data stored in the corresponding cache RAM using the cache address and the valid data length information corresponding to the oldest first-level queue node in the first-level cache queue and writes it into the flash memory file. After the compressed file is written, the corresponding cache RAM is released and an upload request is initiated to the upload module.

7. The method for voice data collection and transmission based on embedded RTOS according to claim 6, characterized in that: The step S3 also includes: The flash memory queue retrieves its own file storage directory, and sorts the retrieved file names, and creates a corresponding secondary queue node for each of the sorted flash memory files.

8. The method for voice data collection and transmission based on embedded RTOS according to claim 7, characterized in that: The step S4 is specifically as follows: S41, the upload module determines whether the upload request is received or the scheduled upload time is reached, and if so, extracts the flash files in the flash queue in sequence according to the secondary queue nodes through the HTTP protocol and uploads them to the cloud server; S42: The upload module notifies the flash memory system to delete the flash memory file in the flash memory queue that has been uploaded.

9. The method for voice data collection and transmission based on embedded RTOS according to claim 8, characterized in that: The step S4 also includes: When the flash memory file fails to be uploaded, the flash memory file that failed to be uploaded is stored in the flash memory queue again, and the flash memory queue is re-sorted according to the file name and then the secondary queue node is updated.

10. A voice data acquisition and transmission terminal based on embedded RTOS, characterized in that: It comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps in the voice data collection and transmission method based on embedded RTOS described in any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Sound and time recording system of embedded multi-channel phone

    CN102215286A

  • Efficient Use Of Hybrid Media In Cache Architectures

    CN102812444A

  • Method of monitoring movable target and monitoring terminal thereof

    CN106534299A

  • Data dynamic real-time updating method and device and storage medium

    CN111367925A

  • Data file access method and system

    CN114035748A